NAME

App::Regather::Logg - logging class

SYNOPSIS

    use App::Regather::Logg;
    my $log = new App::Regather::Logg( prognam    => 'MyAppName',
			          foreground => $foreground_or_syslog,
			          colors     => $wheather_to_use_term_colors );
    $log->cc( pr => 'info', fm => "App::Regather::Logg initialized ... (write to syslog)" );
    $log->cc( fg => 1, fm => "App::Regather::Logg initialized ... (write to STDOUT)" );
    ...
    my $mesg = $ldap->search( filter => "(objectClass=unsearchebleThing)");
    $log->logg_ldap_err( mesg => $mesg );

DESCRIPTION

This is a class to log messages.

CONSTRUCTOR

new

Creates a new App::Regather::Logg object

prognam => 'MyAppName'

program name

foreground => 1 | 0

STDOUT or syslog, default is: 0

colors => 1 | 0

wheather to use terminal colors, default is: 0

if set, then priorities are colored this way:

    info => 'ansi113'

    err => 'bold ansi255 on_ansi196' debug => 'ansi195'

    warning => 'bold ansi237 on_ansi214'

for reference look at Term::ANSIColor

ts_fmt => 'strftime(3) format string'

timestamp format string, default is: "%a %F %T %Z (%z)"

METHODS

conclude

main method to do the job

fg => 1 | 0

foreground: stdin or syslog

pr => 'level[|facility]'

priority

fm => "... %s ... : %m"

sprintf format string, with the addition that %m is replaced with "$!"

ls => [ $a, $b, ... ]

list of values to be passed to sprintf as arguments

nt => 1 | 0

wheather to send (notify) you this message with notify method

cc

alias for conclude method

conclude_ldap_err

method - wrapper around Net::LDAP::Message->error methods

mesg => Net::LDAP::Message object
cc_ldap_err

alias for conclude_ldap_err method

notify

method to be used to send log message via email

set_m

setter to set options from config file

on input it expects App::Regather::Config object section for App::Regather::Logg

set

setter to set one single pair key => value

key => value
get

getter

SEE ALSO

Sys::Syslog, Data::Printer, Term::ANSIColor

AUTHOR

Zeus Panchenko <zeus@gnu.org.ua>

COPYRIGHT

Copyright 2019 Zeus Panchenko.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.