.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "LogLite 3pm" .TH LogLite 3pm "2009-05-13" "perl v5.10.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Log::LogLite \- The \f(CW\*(C`Log::LogLite\*(C'\fR class helps us create simple logs for our application. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Log::LogLite; \& my $LOG_DIRECTORY = "/where/ever/our/log/file/should/be"; \& my $ERROR_LOG_LEVEL = 6; \& \& # create new Log::LogLite object \& my $log = new Log::LogLite($LOG_DIRECTORY."/error.log", $ERROR_LOG_LEVEL); \& \& ... \& \& # we had an error \& $log\->write("Could not open the file ".$file_name.": $!", 4); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" In order to have a log we have first to create a \f(CW\*(C`Log::LogLite\*(C'\fR object. The c object is created with a logging level. The default logging level is 5. After the \f(CW\*(C`Log::LogLite\*(C'\fR object is created, each call to the \f(CW\*(C`write\*(C'\fR method may write a new line in the log file. If the level of the message is lower or equal to the logging level, the message will be written to the log file. The format of the logging messages can be controled by changing the template, and by defining a default message. The class uses the IO::LockedFile class. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .IP "new ( \s-1FILEPATH\s0 [,LEVEL [,DEFAULT_MESSAGE ]] )" 4 .IX Item "new ( FILEPATH [,LEVEL [,DEFAULT_MESSAGE ]] )" The constructor. \s-1FILEPATH\s0 is the path of the log file. \s-1LEVEL\s0 is the defined logging level \- the \s-1LEVEL\s0 data member. \s-1DEFAULT_MESSAGE\s0 will define the \&\s-1DEFAULT_MESSAGE\s0 data member \- a message that will be added to the message of each entry in the log (according to the \s-1TEMPLATE\s0 data member, see below). .Sp The levels can be any levels that the user chooses to use. There are, though, recommended levels: 0 the application is unusable 1 the application is going to be unusable 2 critical conditions 3 error conditions 4 warning conditions 5 normal but significant condition 6 informational 7+ debug-level messages .Sp The default value of \s-1LEVEL\s0 is 5. The default value of \s-1DEFAULT_MESSAGE\s0 is "". Returns the new object. .SH "METHODS" .IX Header "METHODS" .IP "write( \s-1MESSAGE\s0 [, \s-1LEVEL\s0 ] )" 4 .IX Item "write( MESSAGE [, LEVEL ] )" If \s-1LEVEL\s0 is less or equal to the \s-1LEVEL\s0 data member, or if \s-1LEVEL\s0 is undefined, the string in \s-1MESSAGE\s0 will be written to the log file. Does not return anything. .IP "level( [ \s-1LEVEL\s0 ] )" 4 .IX Item "level( [ LEVEL ] )" Access method to the \s-1LEVEL\s0 data member. If \s-1LEVEL\s0 is defined, the \s-1LEVEL\s0 data member will get its value. Returns the value of the \s-1LEVEL\s0 data member. .IP "default_message( [ \s-1MESSAGE\s0 ] )" 4 .IX Item "default_message( [ MESSAGE ] )" Access method to the \s-1DEFAULT_MESSAGE\s0 data member. If \s-1MESSAGE\s0 is defined, the \&\s-1DEFAULT_MESSAGE\s0 data member will get its value. Returns the value of the \s-1DEFAULT_MESSAGE\s0 data member. .IP "log_line_numbers( [ \s-1BOOLEAN\s0 ] )" 4 .IX Item "log_line_numbers( [ BOOLEAN ] )" If this flag is set to true, the string will hold the file that calls the subroutine and the line where the call is issued. The default value is zero. .IP "template( [ \s-1TEMPLATE\s0 ] )" 4 .IX Item "template( [ TEMPLATE ] )" Access method to the \s-1TEMPLATE\s0 data member. The \s-1TEMPLATE\s0 data member is a string that defines how the log entries will look like. The default \s-1TEMPLATE\s0 is: .Sp \&'[] <> ' .Sp Where: .Sp .Vb 10 \& will be replaced by a string that represent \& the date. For example: 09/01/2000 17:00:13 \& will be replaced by the level of the entry. \& will be replaced by a call trace string. For \& example: \& CGIDaemon::listen > MyCGIDaemon::accepted \& will be replaced by the value of the \& DEFAULT_MESSAGE data member. \& will be replaced by the message string that \& is sent to the C method. .Ve .Sp Returns the value of the \s-1TEMPLATE\s0 data member. .SH "AUTHOR" .IX Header "AUTHOR" Rani Pinchuk, rani@cpan.org .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2001\-2002 Ockham Technology N.V. & Rani Pinchuk. All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIIO::LockedFile\fR\|(3)