XLog::Formatter - Base class for pure-perl formatter backends


    package MyFormatter;
    use parent 'XLog::Formatter';
    sub new {
        my ($class, ...) = @_;
        my $self = $class->SUPER::new();
        return $self;
    sub format {
        my ($self, $msg, $level, $module_name, $file, $line, $func) = @_;
        return "[".time()."] $msg at $file:$line";


This is a base class for making pure-perl formatter object. API is very simple - you need to override a single subroutine format and return formatted string.



Create backend object.

Keep in mind that if you override new method you MUST create object by calling SUPER, not blessing new object by yourself, because there will be a C++ proxy object attached to perl object.

format($msg, $level, $module_name, $file, $line, $func)

You must override this method and return resulting formatted log message.

The parameters are:


Log message as it was passed by user


Log level (one of the constants)


Log module name


Filename with path where loging code is written


Line in file where loging code is written


Function or subroutine name where loging code is written

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 47:

=over without closing =back

Around line 73:

=over is the last thing in the document?!