NAME
Medusa::Logger - Simple file-based logger for Medusa audit logging
VERSION
Version 0.03
SYNOPSIS
use Medusa::Logger;
my $logger = Medusa::Logger->new( file => 'audit.log' );
$logger->debug("Starting process");
$logger->info("User logged in: user123");
$logger->error("Failed to connect to database");
DESCRIPTION
Medusa::Logger is a lightweight file-based logger designed for use with the Medusa audit framework. It provides simple timestamped logging to a file with file locking to ensure safe concurrent writes.
METHODS
new
my $logger = Medusa::Logger->new( file => 'audit.log' );
my $logger = Medusa::Logger->new( { file => 'audit.log' } );
Creates a new logger instance. Accepts arguments as a hash or hashref.
- file
-
The path to the log file. Defaults to
audit.logif not specified. The file will be created (or truncated) when the logger is instantiated.
debug
$logger->debug("Debug message here");
Writes a debug-level message to the log file with a GMT timestamp.
info
$logger->info("Informational message");
Writes an info-level message to the log file with a GMT timestamp.
error
$logger->error("Error message");
Writes an error-level message to the log file with a GMT timestamp.
LOG FORMAT
Each log entry is written in the following format:
<timestamp> <message>
Where timestamp is the GMT time when the message was logged.
FILE LOCKING
The logger uses flock to ensure thread-safe writes to the log file, preventing interleaved output when multiple processes write simultaneously.
SEE ALSO
AUTHOR
LNATION <email@lnation.org>
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION <email@lnation.org>.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)