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

NAME

Log::Any::Adapter::Redis - Simple adapter for logging to redis

SYNOPSIS

use Log::Any::Adapter ('Redis',
    host         => 'localhost',
    port         => '6379',
    key          => 'LOG',       # list name
    log_hostname => 0,
    log_pid      => 0,
    database     => 0
);

# or, using the defaults

use Log::Any::Adapter ('Redis');

# or

use Log::Any::Adapter;
...
Log::Any::Adapter->set('Redis',
    host         => 'localhost',
    port         => '6379',
    key          => 'LOG',
    log_hostname => 0,
    log_pid      => 0,
    database     => 0
);

# with minimum level 'warn'

use Log::Any::Adapter (
    'Redis', log_level => 'warn'
);

# re-use existing RedisDB object

use Log::Any::Adapter (
    'Redis', redis_db => $my_redis_db
);

DESCRIPTION

This simple Log::Any adapter logs (RPUSH) each message to the specified list in redis, with a datestamp prefix. This Approach is useful when you have several processes, maybe even running on different machines, and need a fast, central logging solution. An example logwriter is included in the examples.

The log_level attribute may be set to define a minimum level to log.

Category is ignored.

SEE ALSO

Log::Any, Log::Any::Adapter

AUTHOR

Michael Langner, mila at cpan dot org

The module is heavily based on Log::Any::Adapter::File by Jonathan Swartz and David Golden.

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Michael Langner.

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