NAME

DebugLogger - interface for logging debug information provided by Debug module


SYNOPSIS

This module must not be used directly, use inheriting modules instead.

 # example
 use DebugLogger::Stdout;
 my $logger = DebugLogger::Stdout->new;
 $logger
        ->handle(STDERR)  # heuristical default
        ->use_html(0)      # heuristical default
        ->show_ident(1)    # heuristical default
        ->show_time(1)
        ->show_times(1)
        ->times_format("%5.2f, %5.2f, %5.2f, %5.2f")
        ->monitor(":main")
        ->start
 ;
 ...
 $logger->stop;
 ...
 # another example
 use DebugLogger::File;
 DebugLogger::File->new->set_safe_append(1)->monitor(":all")->start;


DESCRIPTION

This abstract module is used to actually log the provided debug information.


SEE ALSO

the Debug manpage, the DebugLogger::Stdout manpage, the DebugLogger::File manpage, the DebugLogger::PackageGroups manpage.


REQUIREMENTS

the Exception manpage, the Debug manpage, the DebugLogger::PackageGroups manpage, the Date::TimeFormat manpage.


CONSTRUCTOR

new

description
Creates DebugLogger object.

parameters
Class name like any constructor.

Other parameters are protected.

returns
New created DebugLogger object.


METHODS

set_monitoring

synopsis
 $logger->set_monitoring($value, ':main', 'My::Package');
description
Adds or removes given packages or groups of packages (defined in the DebugLogger::PackageGroups manpage) to/from monitor list.

parameters
 * boolean value: 1/0 - add/remove
 * package names or package group aliases
returns
Self.

monitor

synopsis
 $logger->monitor(':main', 'My::Package');
description
Adds given packages or groups of packages (defined in the DebugLogger::PackageGroups manpage) to monitor list.

parameters
Package names or package group aliases.

returns
Self.

unmonitor

synopsis
 $logger->unmonitor(':main', 'My::Package');
description
Removes given packages or groups of packages (defined in the DebugLogger::PackageGroups manpage) from monitor list.

parameters
Package names or package group aliases.

returns
Self.

start

synopsis
 $logger->start();
 ...
 $logger->stop();
description
Starts logging the Debug manpage information.

parameters
None.

returns
Self.

stop

synopsis
 $logger->start();
 ...
 $logger->stop();
description
Stops logging the Debug manpage information. Automatically called on DESTROY.

parameters
None.

returns
Self.

handler

description
Pure virtual method. Actually logs debug line.

parameters
Scalar - debug line without a trailing EOLN.

returns
None.


OPTION MODIFIERS

[option]($value), [option]()

synopsis
 $logger->show_time(1)->use_html(0);
 * use_html    - default: 2 (smart)
 * show_header - default: 1
 * show_ident  - default: 2 (smart)
 * show_time   - default: 0
 * show_times  - default: 0

show_prefix([$value])

synopsis
 $logger->show_prefix(6)->start;
description
This is just a three-at-once shortcut for show_ident, show_time and show_times options. undef value means reset to the default (see values above). 0 to 7 values mean 3 bits for ``ident'', ``time'' and ``times'' (i.e. 0 means no header options, 1 means ``ident'' only, 2 means ``time'' only, 4 means ``times'' only and so on).

If no value is passed then the current artificial ``prefix'' value is evaluated and returned (i.e. undef for the default, or 0 to 7).


ATTRIBUTE MODIFIERS

set_[attribute]($value), get_[attribute]()

synopsis
 $logger->set_text_join_format("\n")->set_html_join_format("<BR>");
 * text_header        - default: "[Starting debugging log]\n"
 * html_header        - default: both html-comment and cgi-header
 * ident_string       - default: "Debug",
 * time_string        - default: "%H:%M:%S",
 * times_string       - default: "%6.2f,%6.2f",
 * text_prefix_format - default: "[%s] ",
 * html_prefix_format - default: "<I>[%s]</I> ",
 * text_line_format   - default: "%s%s\n",
 * html_line_format   - default: "\n<BR><B>%s%s</B><BR>\n"
 * text_join_format   - default: "\n%s"
 * html_join_format   - default: "\n   <BR>%s",

If $Podius::PROJECTS_HOME and $Podius::PROJECT_NAME constants are defined, they are added in the header info.