The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


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


version 0.009


    use Log::Smart -timestamp;
    LOG("write a message");
    DUMP("dump the data structures", $arg);
    YAML("dump the data structures back into yaml", $arg)


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 + .log with using this module.

It exports a function that you can put just about anywhere in your Perl code to make 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.log"

    package Example;
    use Log::Smart -name => 'mydebug.mylog';
    #file name "mydebug.mylog"

WARNING: This module automatically determines the output location(need write permission) and the filename when you don't use some options. You should carefully use it, otherwise the file of same name is overwrited.


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 of review.



To write variable to the file.


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


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


To close file handle if you want expressly.


    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.


Kazuhiro Shibuya, <k42uh1r0 at>


Please report any bugs or feature requests to, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


Copyright 2007-2008 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.