Class: Log4Ruby::ParameterFormatters
- Inherits:
-
Object
- Object
- Log4Ruby::ParameterFormatters
- Defined in:
- lib/log4ruby/formatters/pattern_formatter.rb
Overview
Some common parameter formatters to use with the pattern formatter.
Class Method Summary collapse
-
.logger_formatter(index) ⇒ Object
Returns a logger formatter that will format logger objects.
-
.timestamp_formatter(format_string) ⇒ Object
Returns a timestamp formatter that will format time objects using the specified format string.
Class Method Details
.logger_formatter(index) ⇒ Object
Returns a logger formatter that will format logger objects.
1 would be only the name of the logger, 2 would be the name of the logger’s parent and the name of the logger, and so on…
66 67 68 69 |
# File 'lib/log4ruby/formatters/pattern_formatter.rb', line 66 def self.logger_formatter(index) start = 0 - index Proc.new { |logger| logger.full_name.split(".")[start..-1].join(".") } end |
.timestamp_formatter(format_string) ⇒ Object
Returns a timestamp formatter that will format time objects using the specified format string.
74 75 76 |
# File 'lib/log4ruby/formatters/pattern_formatter.rb', line 74 def self.(format_string) Proc.new { || .strftime(format_string) } end |