Changeset 389

Show
Ignore:
Timestamp:
12/19/01 01:47:39
Author:
miyagawa
Message:

update README

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Log-Dispatch-Config/trunk/README

    r388 r389  
    9696        "format" defined here would apply to all the log messages to 
    9797        dispatchers. This parameter is optional. 
     98 
     99        See the section on "CALLER STACK" for details about package, line 
     100        number and filename. 
    98101 
    99102  PARAMETERS FOR EACH DISPATCHER 
     
    248251          Log::Dispatch::Config->configure($config); 
    249252 
    250 TODO 
    251     *   LogLevel configuration depending on caller package like log4j? 
     253CALLER STACK 
     254    When you call logging method from your subroutines / methods, caller 
     255    stack would increase and thus you can't see where the log really comes 
     256    from. 
     257 
     258      package Logger; 
     259      my $Logger = Log::Dispatch::Config->instance; 
     260 
     261      sub logit { 
     262          my($class, $level, $msg) = @_; 
     263          $Logger->$level($msg); 
     264      } 
     265 
     266      package main; 
     267      Logger->logit('debug', 'foobar'); 
     268 
     269    You can adjust package variable $Log::Dispatch::Config::CallerDepth to 
     270    change the caller stack depth. The default value is 3, (which depends 
     271    heavily on Log::Dispatch's undocumented implementation. It might be 
     272    changed in future). 
     273 
     274      sub logit { 
     275          my($class, $level, $msg) = @_; 
     276          local $Log::Dispatch::Config::CallerDepth = 4; 
     277          $Logger->$level($msg); 
     278      } 
    252279 
    253280AUTHOR