lib/eco/api/common/session/logger.rb in eco-helpers-3.0.20 vs lib/eco/api/common/session/logger.rb in eco-helpers-3.0.21
- old
+ new
@@ -3,9 +3,18 @@
module Common
module Session
class Logger < Eco::Language::BasicLogger
TIMESTAMP_PATTERN = '%Y-%m-%dT%H:%M:%S'.freeze
+ require_relative 'logger/channels'
+ include Channels
+
+ channels! do |channel, message = nil, &block|
+ format_proc(console: true) do |severity, datetime, msg, formatted_msg|
+ cache.add(severity, datetime, msg, formatted_msg)
+ end.call(channel, Time.now, 'prog_name', message || block.call)
+ end
+
attr_reader :cache
def initialize(file_level: ::Logger::DEBUG, log_file: nil, enviro: nil, **kargs)
super(**kargs)