1: <?php
2: /**
3: * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
4: * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
5: *
6: * Licensed under The MIT License
7: * Redistributions of files must retain the above copyright notice.
8: *
9: * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
10: * @link https://cakephp.org CakePHP(tm) Project
11: * @since 3.0.0
12: * @license https://opensource.org/licenses/mit-license.php MIT License
13: */
14: namespace Cake\Log;
15:
16: use Psr\Log\LogLevel;
17:
18: /**
19: * A trait providing an object short-cut method
20: * to logging.
21: */
22: trait LogTrait
23: {
24: /**
25: * Convenience method to write a message to Log. See Log::write()
26: * for more information on writing to logs.
27: *
28: * @param mixed $msg Log message.
29: * @param int|string $level Error level.
30: * @param string|array $context Additional log data relevant to this message.
31: * @return bool Success of log write.
32: */
33: public function log($msg, $level = LogLevel::ERROR, $context = [])
34: {
35: return Log::write($level, $msg, $context);
36: }
37: }
38: