lib/YuiRestClient/Logger.pm

NAME

YuiRestClient::Logger - class to log messages

COPYRIGHT

Copyright 2021 SUSE LLC

SPDX-License-Identifier: FSFAP

AUTHORS

QE Yam <qe-yam at suse de>

SYNOPSIS

YuiRestClient::Logger->get_instance({format => \&bmwqemu::log_format_callback, 
                       path => $path_to_log, level => $yui_log_level});

YuiRestClient::Logger->get_instance()->debug('Finding widget by url: ' . $uri);
YuiRestClient::Logger->info("Info message");
YuiRestClient::Logger->warn("Warn message");
YuiRestClient::Logger->error("Error message");
YuiRestClient::Logger->fatal("Fatal message");

DESCRIPTION

Overview

A class that provides logging services. The class uses Mojo::Log for logging and works with Term::ANSIColor to colorize the log messages according to their level.

Class and object methods

get_instance(%args) - create or use existing logger instance

The %arg named parameters are

An instance for Logger is only created on the first invocation of get_instance(), further invocations use the already existing instance.

debug($message) - logs a debug message

Debug messages are logged in white text color.

info($message) - logs an info message

Info messages are logged in blue text color.

warn($message) - logs a warn message

Warn messages are logged in yellow text color.

error($message) - logs an error message

Error messages are logged in bold red text color.

fatal($message) - logs a fatal message

Fatal messages are logged in bold red text color.