Class: Object

Inherits:
BasicObject
Defined in:
lib/logjam/object.rb

Overview

! /usr/bin/env ruby

Copyright ©, 2013 Peter Wood See the license.txt for details of the licensing of the code in this file.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.logObject

This method provides a class level accessor to obtain a logger. Unless a name is specified the logger returned is the default one.



15
16
17
# File 'lib/logjam/object.rb', line 15

def self.log
   LogJam.get_logger
end

.log=(logger) ⇒ Object



19
20
21
# File 'lib/logjam/object.rb', line 19

def self.log=(logger)
   LogJam.get_logger.logger = logger
end

.set_logger_name(name, context = {}) ⇒ Object

This method allows a class to specify the name of the logger that it uses once, generally within the class definition.

Parameters

name

The name of the logger used by the class.

context

A Hash of additional parameters that are specific to the class to which LogJam is being applied.



30
31
32
# File 'lib/logjam/object.rb', line 30

def self.set_logger_name(name, context={})
   LogJam.apply(self, name, context)
end

Instance Method Details

#logObject

This method provides an instance level accessor to obtain a logger. Unless a name is specified the logger returned is the default one.



9
10
11
# File 'lib/logjam/object.rb', line 9

def log
   LogJam.get_logger
end