NAME

Log::Basic - Perl extension for simple logging.

SYNOPSIS

perl -MLog::Basic -e 'info "hey"'

use Log::Basic;
$Log::Basic::VERBOSITY=3;
debug "stuff"; # won't be printed
info "here is the info message"; # won't be printed
warning "wow! beware!";
error "something terrible happend !";
msg "this message will be displayed whatever the verbosity level";
sep "a separator";
fatal "fatal error: $!";

DESCRIPTION

Log::Basic displays formatted messages according to the defined verbosity level (default:4).

Format

Log messages are formatted as: `[<level>] <date> - <message>`. Dates are formatted as: `YYYY-MM-DD hh:mm:ss`. Your message could be whatever you what.

Levels

Verbosity and associated levels are:

- level 1, `msg`
- level 2, `error`
- level 3, `warn`
- level 4, `info`
- level 5, `debug`
- no level, `fatal`

Setting verbosity to 3 will print `warn`, `info`, and `msg` only.

Special cases

`fatal` is a special level, corresponding to perl's `die()`.

Separator is a special functions which display a line of 80 dashes, with your message eventually.

Saving to file

All messages will also be appended to a file. If a `./log/` folder exists, a `$$.$0.log` file is created within this folder, otherwise the `$$.$0.log` file is created in the current directory.

EXPORT

debug info warning error msg sep fatal

AUTHOR

Kevin Gravouil, <k.gravouil@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2016 by Kevin Gravouil

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.2 or, at your option, any later version of Perl 5 you may have available.