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;