SourceForge Logo

NAME

Boucherot::log - This is the package that is used for logs in Boucherot.

SYNOPSIS

  use Boucherot::log;

  Boucherot::log::server("this line comes from server");
  Boucherot::log::toserver("this line has been sent to server");
  Boucherot::log::toserver("this line is an error");
  Boucherot::log::command("this line describe a command call");
  Boucherot::log::plugins("this line has been generated by plugins");
  Boucherot::log::dcc("this line has been generated by the dcc engine");
  Boucherot::log::masta("this line logs masta events");
  Boucherot::log::channel("#mychannel","something in the channel");

DESCRIPTION

  *** This package needs to be cleaned ***

This package use Boucherot::config to know what to log, what to display to the screen.

This package manage all kind of logs. The system logs, and the channel logs. The system logs are usefull for debugging. The channel logs are usefull for knowing what's happening on a channel.

Logs try to emulate a IRC Client's ``channel-panel''. The panels are simulated with files.

GISSUML MODEL

package Boucherot::log

Attributs:

 -$  dirlog : SCALAR
 -$  dirlogbase : SCALAR
 -$  dirlogdialog : SCALAR
 -$  stdout : IO
 -$  channels : Hash
 -$  channels_startofline : Hash

Methods:

 -$ AUTOLOAD ( ... ) : ...
 -$ syslog ( sysname : SCALAR, line : SCALAR ) :
 +$ open ( channel : SCALAR ) :
 +$ close ( channel : SCALAR ) : 
 +$ lall ( msg : SCALAR ) : 
 +$ channel ( chan : SCALAR, msg : SCALAR ) : 
 +$ nick ( oldnick : SCALAR , newnick : SCALAR ) : 
 +$ channel_nocr ( chan : SCALAR, msg : SCALAR ) : 
 +$ channel_bind ( $oldchan : SCALAR , $newchan : SCALAR ) : 
 +$ stripmirc ( msg : SCALAR ) : SCALAR 
 +$ backup () : SCALAR
 -$ init_dir () :
 +$ dbg ( args : ARRAY ) : 
 +$ edbg ( args : ARRAY ) : 
 +$ xdbg ( ... ) :
 +$ xdebug ( reference : SCALAR, name="reference" : SCALAR ) : 
 +$ debug_stack () :
 -$ format_objects ( line : SCALAR ) : SCALAR

FUNCTIONS

AUTOLOAD

 -$ AUTOLOAD ( ... ) : ...

This function is autocalled by perl each time a function in this package is not found. This fonction autoload system-log functions.

Those functions are:

  'server'    => ['-', 1, 0],
  'toserver'  => ['+', 0, 0],
  'command'   => ['=', 1, 0],
  'error'     => ['*', 1, 1],
  'debug'     => ['%', 1, 0],
  'signal'    => ['!', 1, 0],
  'plugins'   => ['$', 1, 0],
  'dcc'       => ['@', 1, 0],
  'masta'     => ['#', 1, 0],

The char associated is the one that will be the first char of the log line on STDOUT.

The first boolean associated indicate if cariage return need to be added to the end of the log line.

The last boolean mean ``Have I to show the file/line number, for the caller for each line of the stream ?''.

syslog

 -$ syslog ( sysname : SCALAR, line : SCALAR ) :

log into a systeme stream. The stream can be STDOUT or a file. _syslog is called each time a error, debug, plugin, ... is called.

open

 +$ open ( channel : SCALAR ) :

Open a given channel.

close

 +$ close ( channel : SCALAR ) :

Close a given channel.

lall

 +$ lall ( msg : SCALAR ) :

Log a line to ALL opened channel.

channel

 +$ channel ( chan : SCALAR, msg : SCALAR ) :

Add a line into a channel.

nick

 +$ nick ( oldnick : SCALAR , newnick : SCALAR ) :

Change a nick into an other. But the panel don't change.

channel_nocr

 +$ channel_nocr ( chan : SCALAR, msg : SCALAR ) :

Log a line into a channel, but don't add \n in the end.

channel_bind

 +$ channel_bind ( $oldchan : SCALAR , $newchan : SCALAR ) :
    *** NOT USED ***

I don't even remerber why I wrote this...

    *** NOT USED ***

stripmirc

 +$ stripmirc ( msg : SCALAR ) : SCALAR

Strip mIRC colors.

backup

 +$ backup () : SCALAR

Close all the files, backup the whole log dir, and re-open the log 
files.

Return the backup dir name. (So it can be used to compress it for exemple, or to move it, or to mail it, etc.)

init_dir

 -$ init_dir () :

Init the package. This method is autocalled when laoding the package.

dbg

 +$ dbg ( args : ARRAY ) : 

Log into I<debug> log file the name of the caller of this function and information 
here this function has been called.

Exemple:

  use Boucherot::log(dbg);

  sub a {
    dbg(@_);
  }

  sub b {
    a(7,6,2,@_,74);
  }

  b(37);

This will create a log line like :

  % +                 m::b /    8: m::a('7','6','2','37','74')

It should be read like :

In main::b (main is abv. ``m''), on line 8, main::a has been called with arguments 7 6 2 37 and 74.

edbg

 +$ edbg ( args : ARRAY ) : 

Log into I<debug> log file the name of the caller of this function and information 
here this function has been called.

End a dbg block.

Exemple:

  use Boucherot::log(dbg);

  sub a {
    dbg(@_);
    # ....
    edbg(@_);
  }

  sub b {
    a(7,6,2,@_,74);
  }

  b(37);

This will create a log line like :

  % +                 m::b /    8: m::a('7','6','2','37','74') 
  % -                 m::b /    8: m::a('7','6','2','37','74')

It should be read like :

In main::b (main is abv. ``m''), on line 8, main::a has been called with arguments 7 6 2 37 and 74.

main::a has finished (called in main::b (main is abv. ``m''), on line 8)

xdbg

 +$ xdbg ( ... ) :

Log into debug log file the caller stack.

xdebug

 +$ xdebug ( reference : SCALAR, name="reference" : SCALAR ) :

Log into debug log file the content of reference.

It use Data::Dumper. see Data::Dumper.

debug_stack

 +$ debug_stack () :

Log into debug log file the caller stack.

format_objects

 -$ format_objects ( line : SCALAR ) : SCALAR

Change a line containing a method/function name with a shorter one.

  Boucherot::signal::message

is changed into:
  Bs::message

AUTHORS

This class was written by Arthibus Gissehel <gissehel@vachefolle.com> in 2000.

NOTES

This class is part of the Boucherot project.