NAME

Mojo::Log::Clearable - Mojo::Log with clearable log handle

SYNOPSIS

use Mojo::Log::Clearable;
my $log = Mojo::Log::Clearable->new(path => $path1);
$log->info($message);
$log->path($path2);
$log->debug($message);
$log->path(undef); # Log to STDERR
$log->warn($message);

DESCRIPTION

Mojo::Log is a simple logger class. It holds a filehandle once it is used to write to a log, which must be cleared to log to a different path. Mojo::Log::Clearable subclasses Mojo::Log to provide a "clear_handle" method and to automatically call it when setting "path".

EVENTS

Mojo::Log::Clearable inherits all events from Mojo::Log.

ATTRIBUTES

Mojo::Log::Clearable inherits all attributes from Mojo::Log and implements the following new ones.

path

my $path = $log->path;
$log     = $log->path('/var/log/mojo.log');

Log file path used by "handle". Clears "handle" when set.

METHODS

Mojo::Log::Clearable inherits all methods from Mojo::Log and implements the following new ones.

clear_handle

$log->clear_handle;

Clears "handle" attribute, it will be set from the default when next accessed.

AUTHOR

Dan Book, dbook@cpan.org

COPYRIGHT AND LICENSE

Copyright 2015, Dan Book.

This library is free software; you may redistribute it and/or modify it undef the terms of the Artistic License version 2.0.

SEE ALSO

Mojo::Log