getMessage()} in {$e->getFile()}({$e->getLine()})"; } /** * Log an error message using printf format. */ public static function error(string $msg, ...$args) { if (self::$verbosity > 0) { self::write('ERROR', $msg, $args); } } /** * Log a warning message using printf format. */ public static function warning(string $msg, ...$args) { if (self::$verbosity > 1) { self::write('WARN', $msg, $args); } } /** * Log an info message using printf format. */ public static function info(string $msg, ...$args) { if (self::$verbosity > 2) { self::write('INFO', $msg, $args); } } /** * Log a debug message using printf format. */ public static function debug(string $msg, ...$args) { if (self::$verbosity > 3) { self::write('DEBUG', $msg, $args); } } /** * Log an exception as an error. */ public static function errorex(Throwable $e, bool $withtrace = false) { if (self::$verbosity > 0) { $msg = self::exceptionmessage($e); if ($withtrace) { // TODO: Maybe print a more beautiful stack trace. $msg .= PHP_EOL . $e->getTraceAsString(); } self::write('ERROR', $msg); } } /** * Log an exception as a warning. */ public static function warningex(Throwable $e) { if (self::$verbosity > 1) { self::write('WARN', self::exceptionmessage($e)); } } /** * Log an exception as an info. */ public static function infoex(Throwable $e) { if (self::$verbosity > 2) { self::write('INFO', self::exceptionmessage($e)); } } /** * Log an exception as a debug. */ public static function debugex(Throwable $e) { if (self::$verbosity > 3) { self::write('DEBUG', self::exceptionmessage($e)); } } }