package Common::Debug;
use strict;

#
# Debug.pm
#
# Provides a simple interface to emit debugging messages.
# The advantage to using this over a simple 'print STDERR' is that this
# code checks an environmental variable...

use Carp;

use Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK);
@ISA       = qw(Exporter);
@EXPORT    = qw(debug);
@EXPORT_OK = qw(debug);

sub debug {
    if ( $ENV{DEBUG} == $ENV{CLIENT_ID} ) {
        my $msg = shift;
        print STDERR "[" . localtime() . "] [debug] [$$] $msg\n";
    }
}

###
1;    # Play nicely.
###
