NAME

Doit::Log - logging with Doit

SYNOPSIS

use Doit;
use Doit::Log;

info "information";
warning "warning";
error "this will die";

Doit::Log::set_label("hostname");
Doit::Log::set_label(undef);

DESCRIPTION

Doit::Log is a package embedded in Doit.pm and provides functionality for screen logging. All logging functions create colored output, if Term::ANSIColor is available (but not on Windows).

FUNCTIONS

info

info $message;

Write a green "INFO" with the given $message. By default exported.

warning

warning $message;

Write a red "WARN" with the given $message. By default exported.

error

error $message;

Write a red "ERROR" with the given $message and throw an exception, similar to a die. By default exported.

set_label

Doit::Log::set_label("[additional label]");
Doit::Log::set_label(undef);

Set or unset an additional label which is used while logging. The first example would cause log output to look like this:

INFO [additional label]: message

The 2nd example would unset this change:

INFO: message

AUTHOR

Slaven Rezic <srezic@cpan.org>

COPYRIGHT

Copyright (c) 2017 Slaven Rezic. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Doit.