module PaulBunyan
Example Usage:
class MyClass include PaulBunyan def initialize logger.info{ "something is working!" } end end
Constants
- ANSI_REGEX
- FileTransfer
- INTERNAL_PARAMS
- RenderedTemplate
- RequestAggregator
- VERSION
- VIEWS_PATTERN
Attributes
default_formatter_type[RW]
Public Class Methods
add_logger(logger)
click to toggle source
# File lib/paul_bunyan.rb, line 59 def add_logger(logger) @logger ||= LogRelayer.new @logger.add_logger(logger) logger end
create_logger(logdev, shift_age = 0, shift_size = 1048576, formatter_type: PaulBunyan.default_formatter_type)
click to toggle source
# File lib/paul_bunyan.rb, line 51 def create_logger(logdev, shift_age = 0, shift_size = 1048576, formatter_type: PaulBunyan.default_formatter_type) logger = Logger.new(logdev, shift_age, shift_size) logger.formatter = default_formatter(formatter_type) unless formatter_type.nil? logger.extend(TaggedLogging) if logger.formatter.respond_to?(:tagged) logger.extend(MetadataLogging) if logger.formatter.respond_to?(:with_metadata) add_logger(logger) end
logger()
click to toggle source
# File lib/paul_bunyan.rb, line 46 def logger create_logger(STDOUT) unless @logger @logger end
remove_logger(logger)
click to toggle source
# File lib/paul_bunyan.rb, line 65 def remove_logger(logger) @logger.remove_logger(logger) if @logger end
strip_ansi(value)
click to toggle source
# File lib/paul_bunyan.rb, line 38 def strip_ansi(value) if value.respond_to?(:to_str) value.to_str.gsub(ANSI_REGEX, '') elsif value value.gsub(ANSI_REGEX, '') end end
Private Class Methods
default_formatter(formatter_type)
click to toggle source
# File lib/paul_bunyan.rb, line 69 def default_formatter(formatter_type) case formatter_type when :json JSONFormatter.new when :text TextFormatter.new else fail UnknownFormatterError, "Unknown formatter type #{formatter_type}" end end
Public Instance Methods
logger()
click to toggle source
# File lib/paul_bunyan.rb, line 29 def logger PaulBunyan.logger end