Class Ramaze::Logger::Informer
In: lib/ramaze/log/informer.rb
Parent: Object

A minimal logger for Ramaze, supports files, CLI, colors and some customization.

Methods

closed?   log   log_interpolate   new   shutdown   timestamp  

Included Modules

Logging Innate::Traited

Constants

COLORS = { :dev => :blue, :debug => :yellow, :info => :green, :warn => :red, :error => :red, }   Which tag should be in what color

Attributes

colorize  [RW] 
log_levels  [RW] 
out  [RW] 

Public Class methods

Create a new instance of Informer.

@example

  Informer.new          # => logs to stdout with all levels being shown.
  Informer.new($stderr) # => same, but to stderr

  # same, but logs to the file foo.log (or creates it if it doesn't
  # exist yet)
  Informer.new("foo.log")

  Informer.new($stdout, [:info]) #=> show only #info messages to stdout.

@param [String] out Specifies where the output should go. By default

 this is set to STDOUT.

@param [Array] log_leves Array containing the levels that should be

 logged.

Public Instance methods

Integration to Logging

@param [String] tag The log level for the current message(s). @param [Array] messages Array containing the data that should be logged.

Takes the prefix (tag), text and timestamp and applies it to the :format trait.

@param [String] prefix @param [String] text @param [Integer] time

Close the file we log to if it isn‘t closed already.

This uses timestamp trait or a date in the format of

  %Y-%m-%d %H:%M:%S
  # => "2007-01-19 21:09:32"

[Validate]