Class: JuanPelota::Logger
- Inherits:
-
Sidekiq::Logging::Pretty
- Object
- Sidekiq::Logging::Pretty
- JuanPelota::Logger
- Defined in:
- lib/juan_pelota/logger.rb
Constant Summary collapse
- IGNORABLE_STATUSES =
%w{start done queueing}.freeze
Instance Attribute Summary collapse
-
#program_name ⇒ Object
Returns the value of attribute program_name.
-
#raw_message ⇒ Object
writeonly
Sets the attribute raw_message.
-
#severity ⇒ Object
Returns the value of attribute severity.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#program_name ⇒ Object
Returns the value of attribute program_name.
12 13 14 |
# File 'lib/juan_pelota/logger.rb', line 12 def program_name @program_name end |
#raw_message=(value) ⇒ Object
Sets the attribute raw_message
12 13 14 |
# File 'lib/juan_pelota/logger.rb', line 12 def (value) @raw_message = value end |
#severity ⇒ Object
Returns the value of attribute severity.
12 13 14 |
# File 'lib/juan_pelota/logger.rb', line 12 def severity @severity end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
12 13 14 |
# File 'lib/juan_pelota/logger.rb', line 12 def @timestamp end |
Class Method Details
.pid ⇒ Object
44 45 46 |
# File 'lib/juan_pelota/logger.rb', line 44 def self.pid ::Process.pid end |
.tid ⇒ Object
48 49 50 |
# File 'lib/juan_pelota/logger.rb', line 48 def self.tid ::Thread.current.object_id.to_s(36) end |
Instance Method Details
#call(severity, time, program_name, incoming_message) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/juan_pelota/logger.rb', line 17 def call(severity, time, program_name, ) self.severity = severity self. = time.utc.iso8601 self.program_name = program_name self. = return if config.filtered_workers.include?(worker_name.to_s) && IGNORABLE_STATUSES.include?(status) { '@type' => 'sidekiq', '@timestamp' => , '@status' => status, '@severity' => severity.downcase, '@run_time' => run_time, '@message' => , '@fields' => { pid: self.class.pid, tid: self.class.tid, context: context, program_name: program_name, worker: worker_name, arguments: arguments, }, }.to_json + "\n" end |