From 9c951f0d21d5144748e2c5d490d673a5632b8291 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Sun, 16 Jan 2011 23:41:08 -0700 Subject: [PATCH] Oops, wrong file. --- src/API/Std.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/API/Std.pm b/src/API/Std.pm index 1d9ab2c..cb909d2 100644 --- a/src/API/Std.pm +++ b/src/API/Std.pm @@ -87,4 +87,24 @@ sub trans } } +# Error subroutine. +sub err +{ + my ($lvl, $msg) = @_; + + # Check for an invalid level. + if ($lvl =~ m/[^0-9]/) { + return 0; + } + + # Level 1: Print to screen. + if ($lvl => 1) { + API::Log::println("ERROR: $msg"); + } + # Level 2: Log to file. + if ($lvl => 2) { + API::Log::alog("ERROR: $msg"); + } +} + 1;