$context Additional context to log. */ public function log( string $message, array $context = [] ) { $this->write_log( 'info', $message, $context ); } /** * Logs a debug message. * * @param string $message The message to log. * @param array $context Additional context to log. */ public function debug( string $message, array $context = [] ) { $this->write_log( 'debug', $message, $context ); } /** * Logs an informational message. * * @param string $message The message to log. * @param array $context Additional context to log. */ public function info( string $message, array $context = [] ) { $this->write_log( 'info', $message, $context ); } /** * Logs a warning message. * * @param string $message The message to log. * @param array $context Additional context to log. */ public function warning( string $message, array $context = [] ) { $this->write_log( 'warning', $message, $context ); } /** * Logs an error message. * * @param string $message The message to log. * @param array $context Additional context to log. */ public function error( string $message, array $context = [] ) { $this->write_log( 'error', $message, $context ); } /** * Logs a critical message. * * @param string $message The message to log. * @param array $context Additional context to log. */ public function critical( string $message, array $context = [] ) { $this->write_log( 'critical', $message, $context ); } /** * Logs a handled exception or error value. * * @param mixed $exception Throwable, WP_Error, PHP/HTTP/DB error data. * @param string $event Channel-relative event name. * @param array $context Additional context to log. */ public function exception( $exception, string $event = 'legacy_log', array $context = [] ) { AO_Logger::instance()->channel( 'core' )->exception( $exception, $event, $context ); } /** * Routes legacy trait calls to the central logger. * * @param string $level Log level. * @param string $message Log message. * @param array $context Log context. */ private function write_log( string $level, string $message, array $context ): void { AO_Logger::instance()->record( $level, 'core', 'legacy_log', $message, $context ); } }