NAME

App::ConvertLogAnyToLogGer - Convert code that uses Log::Any to use Log::ger

VERSION

This document describes version 0.002 of App::ConvertLogAnyToLogGer (from Perl distribution App-ConvertLogAnyToLogGer), released on 2017-07-03.

SYNOPSIS

See the included script convert-log-any-to-log-ger.

FUNCTIONS

convert_log_any_to_log_ger

Usage:

convert_log_any_to_log_ger(%args) -> [status, msg, result, meta]

Convert code that uses Log::Any to use Log::ger.

This is a tool to help converting code that uses Log::Any to use Log::ger. It converts:

use Log::Any;
use Log::Any '$log';

use Log::Any::IfLOG;
use Log::Any::IfLOG '$log';

to:

use Log::ger;

It converts:

$log->warn("blah");
$log->warn("blah", "more blah");

to:

log_warn("blah");
log_warn("blah", "more blah"); # XXX this actually does not work and needs to be converted to e.g. log_warn(join(" ", "blah", "more blah"));

It converts:

$log->warnf("blah %s", $arg);

to:

log_warn("blah %s", $arg);

It converts:

$log->is_warn

to:

log_is_warn()

This function is not exported.

Arguments ('*' denotes required arguments):

  • input* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

detect_log_any_usage

Usage:

detect_log_any_usage(%args) -> [status, msg, result, meta]

Detect whether code uses Log::Any.

The CLI will return exit code 1 when usage of Log::Any is detected. It will return 0 otherwise.

This function is not exported.

Arguments ('*' denotes required arguments):

  • input* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-ConvertLogAnyToLogGer.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-ConvertLogAnyToLogGer.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-ConvertLogAnyToLogGer

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

Log::ger

Log::Any

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by 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.