NAME

Log::Smart - Messages for smart logging to the file

VERSION

version 0.004

SYNOPSIS

use Log::Smart -timestamp;

LOG("write a message");
DUMP("dump the data structures", $arg);
YAML("dump the data structures back into yaml", $arg)

DESCRIPTION

Log::Smart provides logging methods that is easy to use.

This module automatically creates and opens the file for logging. It is created to location of the file that used this module. And name of the file is the namespace + .smart_log with using this module. It exports a function that you can put just about anywhere in your Perl code tomake it logging.

To change the location or filename, you can use the options. Please refer to OPTIONS for more information on.

package Example;

use Log::Smart;
#file name "Example.smart_log"


package Example;

use Log::Smart -name => 'mydebug.log';
#file name "mydebug.log"

WARNING: This module automatically determines the output location and the filename when you don't use some options. You should carefully use it, otherwise the file of same name is overwrited. And this module uses a source filter. If you don't like that, don't use this.

BACKWARD INCOMPATIBILITY

Current version of Log::Smart was once called Debug::Smart. When I released this module naming it to Debug::Smart was wrong. Debug::Smart was unmatched this module functions. Thanks for nadim khemir from review.

TRACE

You can trace the variables if you use -trace option. This option specifies the variable's name that is type of SCALAR or ARRAY_REF. TRACE function is automatically added by source code filter(Fillter::Util::Call) and outputs the specified variable's value that each time appeared in the source code.

# you shuld use sigle quote
use Log::Smart -trace => '$var';

my $var = 1;
$var = 2;
$var = 10;

done.

my $var = 1;TRACE $var;
$var = 2;TRACE $var;
$var = 10; TRACE $var;

EXPORT

LOG

To write variable to the file.

DUMP

To write the variable structures to the file with Data::Dumper::Dumper.

YAML

To write the variable structures to the file with YAML::Dump.

TRACE

This function traces valiables. (TRACE is not export if you don't use -trace option)

CLOSE

To close file handle if you want expressly.

OPTIONS

use Log::Smart -path => '/path/to/';

-path option specify output location of the log file.

use Log::Smart -name => 'filename';

-filename option specify the filename.

use Log::Smart -timestamp;

-timestamp option add timestamp to the head of logging message.

use Log::Smart -append

-append option is append mode. Writing at end-of-file. Default is write mode. It will be overwritten.

use Log::Smart -trace => '$foo';
or
use Log::Smart -trace => ['$foo', '$bar'];

-trace option traces the variable of specified the name. You should write the single quoted variable's name.

SEE ALSO

Filter::Util::Call

AUTHOR

Kazuhiro Shibuya, <k42uh1r0 at gmail.com>

BUGS

Please report any bugs or feature requests to bug-debug-simple@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2007 Kazuhiro Shibuya, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.