NAME

Flux::Log - storage implemented as log.

VERSION

version 1.00

SYNOPSIS

my $log = Flux::Log->new("/var/log/my.log");

$log->write("abc\n");
$log->commit;

my $in = $log->in("reader1");
my $str = $in->read;
$in->commit;

DESCRIPTION

Flux::Log is similar to Flux::File, but designed to work with logs (files which can rotate sometimes).

It supports safe writes to rotating logs, i.e. it will automatically switch to the new file instead of writing to foo.log.1.

Note that this module doesn't rotate logs by itself. You have to use logrotate(8) or it's replacement for that.

You don't have to use this module to write logs. If some other program writes a log, you can use Flux::Log to represent such log, and use it to generate input stream objects via $storage->in($client_name).

NAMED CLIENTS

Flux::Log implements the Flux::Storage::Role::ClientList role. It stores client's position in the $log.pos/ dir.

For example, if your log is called /var/log/my-app.log, and you attempt to create an input stream by calling $storage->in("abc"), /var/log/my-app.log.pos/ dir will be created (if necessary), and position will be stored in /var/log/my-app.log.pos/abc.

METHODS

in($client_name)
in({ pos = $posfile })>

Construct input stream from a client name or a posfile name.

SEE ALSO

Log::Unrotate - this module does all the heavy lifting for safe log readings.

Flux::File - simple line-based storage for which this class is a specialization.

AUTHOR

Vyacheslav Matyukhin <me@berekuk.ru>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Yandex LLC.

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