#!/usr/bin/perl # $Id: dbug.pm $ package dbug; require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(dbug); use strict; use warnings; use POSIX; my $timestamp = POSIX::strftime("%m/%d/%Y %H:%M:%S", localtime); sub pdebug { my $logDate = POSIX::strftime('%y%m%d', localtime(time)); my $component = shift; my $string = shift; my $logto = "/var/log/logfile.log.$logDate"; open (LOGGER, '>>', $logto) or die("Cannot open Log"); print LOGGER "$timestamp - [$component] $string"; close(LOGGER); }