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::ger::Screen - Convenient packaging of Log::ger + Lg:Output::Screen + Lg:Level::FromVar + Lg:Level::FromEnv for one-liner

VERSION

version 0.005

SYNOPSIS

Mostly in one-liners:

% perl -MLog::ger::Screen -E'log_warn "blah..."; ...'

Set level from package variable (see Log::ger::Level::FromVar for more details):

% perl -E'BEGIN { $Default_Log_Level = 'info' } use Log::ger::Screen; ...'

Set level from environment variable (see Log::ger::Level::FromEnv for more details):

% TRACE=1 perl ...

But you can certainly use this module in your CLI script, as a more lightweight alternative to Log::ger::App when you only want to output log to screen:

#!perl
use strict;
use warnings;
BEGIN { our $Default_Log_Level = 'info' }
use Log::ger::Screen;
use Log::ger;

use Getopt::Long;

log_debug "Starting program ...";
...
log_debug "Ending program ...";

DESCRIPTION

This is just a convenient packaging of:

use Log::ger::Level::FromVar;
use Log::ger::Level::FromEnv;
use Log::ger::Output 'Screen';
use Log::ger; # in the caller's package

mostly for one-liner usage, but you are also welcome to use it in your CLI scripts.

SEE ALSO

Log::ger::App

Log::ger

Log::ger::Level::FromVar

Log::ger::Level::FromEnv

Log::ger::Output::Screen

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2022, 2020 by perlancar <perlancar@cpan.org>.

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