Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module ActiveSupport
- module TaggedLogging
- module Formatter
- def current_tags
- thread_key = @thread_key ||= "activesupport_tagged_logging_tags".freeze
- Thread.current[thread_key] ||= []
- end
- end
- end
- end
- module Coralogix
- class TaggedCoralogixLogger < CoralogixLogger
- def self.get_logger name
- TaggedCoralogixLogger.send(:new, name)
- end
- def add(severity, message = nil, progname = nil, &block)
- if message.nil?
- if block_given?
- message = yield
- else
- message = progname
- end
- end
- tags_text = (Thread.current[:activesupport_tagged_logging_tags] || [])
- .collect { |tag| "[#{tag}] " }
- .join
- super severity, "#{tags_text}#{message}", progname
- end
- end
- end
Add Comment
Please, Sign In to add comment