0) { self::write('ERROR', $msg, $args); } } /** * Log a xarning 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. */ public static function exception(Throwable $e, bool $withtrace = false) { if (self::$verbosity > 0) { $msg = $e->getMessage(); if ($withtrace) { // TODO: Maybe print a more beautiful stack trace. $msg .= PHP_EOL . $e->getTraceAsString(); } self::write('ERROR', $msg); } } }