NAME

Log::Lite - Log info in local file

SYNOPSIS

use Log::Lite qw(logrotate logmode logpath log);

# Optional methods
logrotate("day");		#autocut logfile every day (Default)
logrotate("month");		#autocut logfile every month 
logrotate("year");		#autocut logfile every year 
logrotate("no");		#disable autocut

logmode("log");		#log in file (Default)
logmode("debug");		#output to STDERR
logmode("slient");		#do nothing

logpath("/tmp/mylogpath");	#defined where log files stored
logpath("mylogpath");		#relative path is ok

logsregex("stopword");		#set a regex use to remove words that you do not want to log. Default is [\r\n\t]

# Main method
log("access", "user1", "ip1", "script"); #log in ./log/access_20110206.log
log("access", "user2", "ip2", "script");  #log in the same file as above 
log("debug", "some", "debug", "info", "in", "code"); #log in ./log/debug_20110206.log
log("error", "error information"); # could accept any number of arguments

DESCRIPTION

Module Feature:

1. auto create file named by the first argument.

2. support auto cut log file everyday,everymonth,everyyear.

3. thread safety (open-lock-write-unlock-close everytime).

4. support log/debug/slient mode.

METHODS

logrotate($rotate_mode)

Optional.

"day" : auto cut log file every day

"month" : auto cut log file every month

"year" : auto cut log file every year

"day" by default.

logmode($mode)

Optional.

"log" : log in file

"debug" : print to STDERR

"slient" : do nothing

"log" by default.

logsregex($stopword_regex)

Optional. Set a regex here.

You can use this function to remove those the words you don't want to log.

"[\r\n\t]" by default.

logpath($path)

Optional.

Defined logpath. "./log" by default.

With strawberry perl on windows, you should turn the path, write like below.

logpath("C:\\User\\Yourname");

log($type, $content1, $content2, $content3, ...)

Main method.

Log things.

AUTHOR

Written by ChenGang, [email protected]

https://blog.yikuyiku.com/

COPYRIGHT

Copyright (c) 2011 ChenGang. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Log::Log4perl, Log::Minimal