The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Vote::Count::Log

VERSION 2.02

Vote::Count Logging Methods

LogTo

Sets a path and Naming pattern for writing logs with the WriteLogs method.

  'LogTo' => '/logging_path/election_name'

LogTo will not create a new directory if the directory does not exist.

The default log location is '/tmp/votecount'.

LogPath

Specifies a Path to the Log Files, unlike LogTo, LogPath will create the Path if it does not exist.

LogBaseName

Sets the Base portion of the logfile names, but only if LogPath is specified. The default value is votecount.

WriteLog

Write the logs appending '.brief', '.full', and '.debug' for the three logs where brief is a summary written with the logt (log terse) method, the full transcript log written with logv, and finally the debug log written with logd. Each higher log level captures all events of the lower log levels.

Logged events are not written until WriteLog is called. A fatal runtime error, would prevent execution of a writelog at the end of the script. If you need to see the logs when your program is crashing, set the Debug Flag to write the events as warnings to STDERR while the script is running.

Logging Events

When logging from your methods, use logt for events that produce a summary, use logv for events that should be in the full transcript such as round counts, and finally debug is for events that may be helpful in debugging but which should not be in the transcript. Events written to logt will be included in the verbose log and all events in the verbose log will be in the debug log.

The logx methods will return the current log if called without any message to log.

logt

Record message to the terse (.brief) log.

logv

Record message to the more verbose (.full) log.

logd

Record message to the debug (.debug) log.

Debug Flag

When the debug flag is logx methods will also emit the event as a warning (STDERR). The Debug Flag defaults to off (0), but can be explicitly set via the new method of a Vote::Count object, or toggled by passing 0 or 1 via the Debug Method.

  $Election->Debug(1); # turn debug on
  is( $Election->Action(), $expected, 'Thing Im debugging');
  $Election->Debug(0); # turn debug off

BUG TRACKER

https://github.com/brainbuz/Vote-Count/issues

AUTHOR

John Karr (BRAINBUZ) brainbuz@cpan.org

CONTRIBUTORS

Copyright 2019-2021 by John Karr (BRAINBUZ) brainbuz@cpan.org.

LICENSE

This module is released under the GNU Public License Version 3. See license file for details. For more information on this license visit http://fsf.org.

SUPPORT

This software is provided as is, per the terms of the GNU Public License. Professional support and customisation services are available from the author.