src/helpers/BaseYii.php
public static function log($level, $message, $category = 'application')
    {
        if (LogLevel::DEBUG === $level && !YII_DEBUG) {
            return;
        }

        $logger = static::get('logger', null, false);
        if ($logger) {
            return $logger->log($level, $message, ['category' => $category]);
        }

        error_log($message);
    }
public static function log($level, $message, $category = 'application')
    {
        if (LogLevel::DEBUG === $level && !YII_DEBUG) {
            return;
        }

        $logger = static::get('logger', null, false);
        if ($logger) {
            return $logger->log($level, $message, ['category' => $category]);
        }

        error_log($message);
    }
public static function log ( $ level , $ message , $ category = 'application' ) { if ( LogLevel :: DEBUG === $ level && ! YII_DEBUG ) { return ; } $ logger = static :: get ( 'logger' , null , false ) ; if ( $ logger ) { return $ logger -> log ( $ level , $ message , [ 'category' => $ category ] ) ; } error_log ( $ message ) ; }
Logs given message with level and category.

Uses `logger` service if container is available.
Else logs message with PHP built-in `error_log()`.

@param string $level log level.
@param mixed $message the message to be logged. This can be a simple string or a more
complex data structure, such as array.
@param string $category the category of the message.
@since 3.0.0
@see Psr\Log\LoggerInterface::log()
Logs given message with level and category .