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: /**
26: * Convenience method to write a message to Log. See Log::write()
27: * for more information on writing to logs.
28: *
29: * @param mixed $msg Log message.
30: * @param int|string $level Error level.
31: * @param string|array $context Additional log data relevant to this message.
32: * @return bool Success of log write.
33: */
34: public function log($msg, $level = LogLevel::ERROR, $context = [])
35: {
36: return Log::write($level, $msg, $context);
37: }
38: }
39: