Module: JsonLogging::Helpers
- Defined in:
- lib/json_logging/helpers.rb
Class Method Summary collapse
-
.normalize_timestamp(timestamp) ⇒ Object
Normalize timestamp to ISO8601 with microseconds.
-
.safe_string(obj) ⇒ Object
Safely convert object to string, never raises.
Class Method Details
.normalize_timestamp(timestamp) ⇒ Object
Normalize timestamp to ISO8601 with microseconds
6 7 8 |
# File 'lib/json_logging/helpers.rb', line 6 def () ( || Time.now).utc.iso8601(6) end |
.safe_string(obj) ⇒ Object
Safely convert object to string, never raises
11 12 13 14 15 |
# File 'lib/json_logging/helpers.rb', line 11 def safe_string(obj) obj.to_s rescue "<unprintable>" end |