Class: MonoLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/chef/monologger.rb

Overview

== MonoLogger A subclass of Ruby's stdlib Logger with all the mutex and logrotation stuff ripped out.

Defined Under Namespace

Classes: LocklessLogDevice

Instance Method Summary collapse

Constructor Details

#initialize(logdev) ⇒ MonoLogger

=== Synopsis

Logger.new(name, shift_age = 7, shift_size = 1048576) Logger.new(name, shift_age = 'weekly')

=== Args

+logdev+:: The log device. This is a filename (String) or IO object (typically +STDOUT+, +STDERR+, or an open file). +shift_age+:: Number of old log files to keep, or frequency of rotation (+daily+, +weekly+ or +monthly+). +shift_size+:: Maximum logfile size (only applies when +shift_age+ is a number).

=== Description

Create an instance.


30
31
32
33
34
35
36
37
38
39
# File 'lib/chef/monologger.rb', line 30

def initialize(logdev)
  @progname = nil
  @level = DEBUG
  @default_formatter = Formatter.new
  @formatter = nil
  @logdev = nil
  if logdev
    @logdev = LocklessLogDevice.new(logdev)
  end
end