NAME

Log::Fine::Levels - Define variable logging levels

SYNOPSIS

Provides logging translations

use Log::Fine::Levels;

# Instantiate the levels object using the default translations
my $levels = Log::Fine::Levels->new();

# Instantiate the levels object using customized translations
my $levels = Log::Fine::Levels->new("Java");

# Supported methods
my @l = $levels->logLevels();   # grab list of levels
my @m = $levels->logMasks();    # grab list of masks

# Translation methods
my $val     = $levels->levelToValue("INFO");
my $bitmask = $levels->maskToValue("LOGMASK_INFO");
my $lvl     = $levels->valueToLevel(3);

DESCRIPTION

Log::Fine::Levels is used by the Log::Fine framework to translate customizable log levels (such as INFO, DEBUG, WARNING, etc) to and from an associated value as well as convenience methods for interacting with log levels (such as grabbing a list of levels).

In addition, the Log::Fine framework supports the notion of a mask, which is used for customizing output. See Log::Fine::Handle for more details as to how masks are used.

Customization

Log::Fine::Levels only provides methods for interacting with log levels and associated log masks. In order to define levels and masks, it must be overridden. Note that, by default, the Log::Fine::Levels::Syslog class is used to define log levels.

Independence

Finally, Log::Fine::Levels is written to be independant of the Log::Fine framework and, as such, does not inherit any methods from Log::Fine. This allows developers to use Log::Fine::Levels by itself for defining customizable level packages for use in their own programs.

METHODS

The following methods are provided:

new

Creates a new Log::Fine::Levels object

Parameters

  • levelmap

    The name of the level map to use (e.g., Syslog, Java, etc)

Returns

an Log::Fine::Levels object

bitmaskAll

Getter for a bitmask representing ALL possible values

Returns

Bitmask representing all possible mask values

levelToValue

Level name to numeric value

Parameters

  • level name

    The name of the level

Returns

The numeric value representing the given level name. Undef if name is not defined

logLevels

Getter for all log levels

Returns

An array representing all level names, sorted by ascending numeric value

logMasks

Getter for all log masks

Returns

An array representing all mask names, sorted by ascending numeric value

maskToValue

Mask name to numeric value

Parameters

  • mask name

    The name of the mask

Returns

The numeric value representing the given mask name. Undef if name is not defined

valueToLevel

Level value to level name

Parameters

  • numeric value

    The numeric value representing a level

Returns

The level name associated with the given numeric value. Undef if the value is not defined

BUGS

Please report any bugs or feature requests to bug-log-fine at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Log-Fine. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Log::Fine::Levels

You can also look for information at:

AUTHOR

Christopher M. Fuhrman, <cfuhrman at pobox.com>

SEE ALSO

perl, syslog, Log::Fine, Sys::Syslog

COPYRIGHT & LICENSE

Copyright (c) 2009, 2010, 2013 Christopher M. Fuhrman, All rights reserved.

This program is free software licensed under the...

The BSD License

The full text of the license can be found in the LICENSE file included with this module.