From 5d62cb21da8c9d81b0b5634da6e4e78da00271d8 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Fri, 27 Nov 2020 10:49:36 +0100 Subject: [PATCH] Maintenance: Migrated not existing log level `notice` to `info`. --- lib/sessions.rb | 4 ++-- lib/sessions/event/broadcast.rb | 6 +++--- lib/sessions/event/spool.rb | 10 +++++----- lib/websocket_server.rb | 20 ++++++++++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/sessions.rb b/lib/sessions.rb index 164d89b93..017c336e8 100644 --- a/lib/sessions.rb +++ b/lib/sessions.rb @@ -802,8 +802,8 @@ returns case level when 'debug' Rails.logger.debug { message } - when 'notice' - Rails.logger.notice message + when 'info' + Rails.logger.info message else Rails.logger.error message end diff --git a/lib/sessions/event/broadcast.rb b/lib/sessions/event/broadcast.rb index df1dbd2b5..4528bd045 100644 --- a/lib/sessions/event/broadcast.rb +++ b/lib/sessions/event/broadcast.rb @@ -16,7 +16,7 @@ To execute this manually, just paste the following into the browser console client_list = Sessions.list client_list.each do |local_client_id, local_client| if local_client_id == @client_id - log 'notice', 'do not send broadcast to it self' + log 'info', 'do not send broadcast to it self' next end @@ -33,14 +33,14 @@ To execute this manually, just paste the following into the browser console next if local_client[:user]['id'].to_i != user_id.to_i - log 'notice', "send broadcast from (#{@client_id}) to (user_id=#{user_id})", local_client_id + log 'info', "send broadcast from (#{@client_id}) to (user_id=#{user_id})", local_client_id websocket_send(local_client_id, @payload['data']) end end # broadcast every client else - log 'notice', "send broadcast from (#{@client_id})", local_client_id + log 'info', "send broadcast from (#{@client_id})", local_client_id websocket_send(local_client_id, @payload['data']) end end diff --git a/lib/sessions/event/spool.rb b/lib/sessions/event/spool.rb index 3931fca9d..c002a6a4c 100644 --- a/lib/sessions/event/spool.rb +++ b/lib/sessions/event/spool.rb @@ -14,9 +14,9 @@ To execute this manually, just paste the following into the browser console # error handling if @payload['timestamp'] - log 'notice', "request spool data > '#{Time.at(@payload['timestamp']).utc.iso8601}'" + log 'info', "request spool data > '#{Time.at(@payload['timestamp']).utc.iso8601}'" else - log 'notice', 'request spool with init data' + log 'info', 'request spool with init data' end if !@session || !@session['id'] @@ -34,15 +34,15 @@ To execute this manually, just paste the following into the browser console # create new msg to push to client if item[:type] == 'direct' - log 'notice', "send spool to (user_id=#{@session['id']})" + log 'info', "send spool to (user_id=#{@session['id']})" else - log 'notice', 'send spool' + log 'info', 'send spool' end websocket_send(@client_id, item[:message]) end # send spool:sent event to client - log 'notice', 'send spool:sent event' + log 'info', 'send spool:sent event' { event: 'spool:sent', data: { diff --git a/lib/websocket_server.rb b/lib/websocket_server.rb index c04cdf7ea..46787be3c 100644 --- a/lib/websocket_server.rb +++ b/lib/websocket_server.rb @@ -49,7 +49,7 @@ class WebsocketServer def self.onopen(websocket, handshake) headers = handshake.headers client_id = websocket.object_id.to_s - log 'notice', 'Client connected.', client_id + log 'info', 'Client connected.', client_id Sessions.create( client_id, {}, { type: 'websocket' } ) return if @clients.include? client_id @@ -64,7 +64,7 @@ class WebsocketServer def self.onclose(websocket) client_id = websocket.object_id.to_s - log 'notice', 'Client disconnected.', client_id + log 'info', 'Client disconnected.', client_id # removed from current client list if @clients.include? client_id @@ -129,7 +129,7 @@ class WebsocketServer end def self.check_unused_connections - log 'notice', 'check unused idle connections...' + log 'info', 'check unused idle connections...' idle_time_in_sec = 4 * 60 @@ -138,7 +138,7 @@ class WebsocketServer next if ( client[:last_ping].to_i + idle_time_in_sec ) >= Time.now.utc.to_i - log 'notice', 'closing idle websocket connection', client_id + log 'info', 'closing idle websocket connection', client_id # remember to not use this connection anymore client[:disconnect] = true @@ -154,7 +154,7 @@ class WebsocketServer # close unused ajax long polling sessions clients = Sessions.destroy_idle_sessions(idle_time_in_sec) clients.each do |client_id| - log 'notice', 'closing idle long polling connection', client_id + log 'info', 'closing idle long polling connection', client_id end end @@ -170,7 +170,7 @@ class WebsocketServer queue = Sessions.queue(client_id) next if queue.blank? - log 'notice', 'send data to client', client_id + log 'info', 'send data to client', client_id websocket_send(client_id, queue) rescue => e log 'error', "problem:#{e.inspect}", client_id @@ -186,9 +186,9 @@ class WebsocketServer def self.log_status # websocket - log 'notice', "Status: websocket clients: #{@clients.size}" + log 'info', "Status: websocket clients: #{@clients.size}" @clients.each_key do |client_id| - log 'notice', 'working...', client_id + log 'info', 'working...', client_id end # ajax @@ -199,11 +199,11 @@ class WebsocketServer clients = clients + 1 end - log 'notice', "Status: ajax clients: #{clients}" + log 'info', "Status: ajax clients: #{clients}" client_list.each do |client_id, client| next if client[:meta][:type] == 'websocket' - log 'notice', 'working...', client_id + log 'info', 'working...', client_id end end