Browse Source

Maintenance: Migrated not existing log level `notice` to `info`.

Thorsten Eckel 4 years ago
parent
commit
5d62cb21da
4 changed files with 20 additions and 20 deletions
  1. 2 2
      lib/sessions.rb
  2. 3 3
      lib/sessions/event/broadcast.rb
  3. 5 5
      lib/sessions/event/spool.rb
  4. 10 10
      lib/websocket_server.rb

+ 2 - 2
lib/sessions.rb

@@ -802,8 +802,8 @@ returns
       case level
       case level
       when 'debug'
       when 'debug'
         Rails.logger.debug { message }
         Rails.logger.debug { message }
-      when 'notice'
-        Rails.logger.notice message
+      when 'info'
+        Rails.logger.info message
       else
       else
         Rails.logger.error message
         Rails.logger.error message
       end
       end

+ 3 - 3
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 = Sessions.list
     client_list.each do |local_client_id, local_client|
     client_list.each do |local_client_id, local_client|
       if local_client_id == @client_id
       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
         next
       end
       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
             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'])
             websocket_send(local_client_id, @payload['data'])
           end
           end
         end
         end
 
 
         # broadcast every client
         # broadcast every client
       else
       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'])
         websocket_send(local_client_id, @payload['data'])
       end
       end
     end
     end

+ 5 - 5
lib/sessions/event/spool.rb

@@ -14,9 +14,9 @@ To execute this manually, just paste the following into the browser console
 
 
     # error handling
     # error handling
     if @payload['timestamp']
     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
     else
-      log 'notice', 'request spool with init data'
+      log 'info', 'request spool with init data'
     end
     end
 
 
     if !@session || !@session['id']
     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
       # create new msg to push to client
       if item[:type] == 'direct'
       if item[:type] == 'direct'
-        log 'notice', "send spool to (user_id=#{@session['id']})"
+        log 'info', "send spool to (user_id=#{@session['id']})"
       else
       else
-        log 'notice', 'send spool'
+        log 'info', 'send spool'
       end
       end
       websocket_send(@client_id, item[:message])
       websocket_send(@client_id, item[:message])
     end
     end
 
 
     # send spool:sent event to client
     # send spool:sent event to client
-    log 'notice', 'send spool:sent event'
+    log 'info', 'send spool:sent event'
     {
     {
       event: 'spool:sent',
       event: 'spool:sent',
       data:  {
       data:  {

+ 10 - 10
lib/websocket_server.rb

@@ -49,7 +49,7 @@ class WebsocketServer
   def self.onopen(websocket, handshake)
   def self.onopen(websocket, handshake)
     headers = handshake.headers
     headers = handshake.headers
     client_id = websocket.object_id.to_s
     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' } )
     Sessions.create( client_id, {}, { type: 'websocket' } )
 
 
     return if @clients.include? client_id
     return if @clients.include? client_id
@@ -64,7 +64,7 @@ class WebsocketServer
 
 
   def self.onclose(websocket)
   def self.onclose(websocket)
     client_id = websocket.object_id.to_s
     client_id = websocket.object_id.to_s
-    log 'notice', 'Client disconnected.', client_id
+    log 'info', 'Client disconnected.', client_id
 
 
     # removed from current client list
     # removed from current client list
     if @clients.include? client_id
     if @clients.include? client_id
@@ -129,7 +129,7 @@ class WebsocketServer
   end
   end
 
 
   def self.check_unused_connections
   def self.check_unused_connections
-    log 'notice', 'check unused idle connections...'
+    log 'info', 'check unused idle connections...'
 
 
     idle_time_in_sec = 4 * 60
     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
       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
       # remember to not use this connection anymore
       client[:disconnect] = true
       client[:disconnect] = true
@@ -154,7 +154,7 @@ class WebsocketServer
     # close unused ajax long polling sessions
     # close unused ajax long polling sessions
     clients = Sessions.destroy_idle_sessions(idle_time_in_sec)
     clients = Sessions.destroy_idle_sessions(idle_time_in_sec)
     clients.each do |client_id|
     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
   end
   end
 
 
@@ -170,7 +170,7 @@ class WebsocketServer
         queue = Sessions.queue(client_id)
         queue = Sessions.queue(client_id)
         next if queue.blank?
         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)
         websocket_send(client_id, queue)
       rescue => e
       rescue => e
         log 'error', "problem:#{e.inspect}", client_id
         log 'error', "problem:#{e.inspect}", client_id
@@ -186,9 +186,9 @@ class WebsocketServer
 
 
   def self.log_status
   def self.log_status
     # websocket
     # websocket
-    log 'notice', "Status: websocket clients: #{@clients.size}"
+    log 'info', "Status: websocket clients: #{@clients.size}"
     @clients.each_key do |client_id|
     @clients.each_key do |client_id|
-      log 'notice', 'working...', client_id
+      log 'info', 'working...', client_id
     end
     end
 
 
     # ajax
     # ajax
@@ -199,11 +199,11 @@ class WebsocketServer
 
 
       clients = clients + 1
       clients = clients + 1
     end
     end
-    log 'notice', "Status: ajax clients: #{clients}"
+    log 'info', "Status: ajax clients: #{clients}"
     client_list.each do |client_id, client|
     client_list.each do |client_id, client|
       next if client[:meta][:type] == 'websocket'
       next if client[:meta][:type] == 'websocket'
 
 
-      log 'notice', 'working...', client_id
+      log 'info', 'working...', client_id
     end
     end
   end
   end