PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
media-cloud-sync / includes / sdk / google / psr / log / src / LoggerTrait.php

LoggerTrait.php in Media Cloud Sync 1.4.2, at includes/sdk/google/psr/log/src/LoggerTrait.php

91 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\GCP\Psr\Log;
4
5 /**
6 * This is a simple Logger trait that classes unable to extend AbstractLogger
7 * (because they extend another class, etc) can include.
8 *
9 * It simply delegates all log-level-specific methods to the `log` method to
10 * reduce boilerplate code that a simple Logger that does the same thing with
11 * messages regardless of the error level has to implement.
12 */
13 trait LoggerTrait
14 {
15 /**
16 * System is unusable.
17 */
18 public function emergency(string|\Stringable $message, array $context = []) : void
19 {
20 $this->log(LogLevel::EMERGENCY, $message, $context);
21 }
22 /**
23 * Action must be taken immediately.
24 *
25 * Example: Entire website down, database unavailable, etc. This should
26 * trigger the SMS alerts and wake you up.
27 */
28 public function alert(string|\Stringable $message, array $context = []) : void
29 {
30 $this->log(LogLevel::ALERT, $message, $context);
31 }
32 /**
33 * Critical conditions.
34 *
35 * Example: Application component unavailable, unexpected exception.
36 */
37 public function critical(string|\Stringable $message, array $context = []) : void
38 {
39 $this->log(LogLevel::CRITICAL, $message, $context);
40 }
41 /**
42 * Runtime errors that do not require immediate action but should typically
43 * be logged and monitored.
44 */
45 public function error(string|\Stringable $message, array $context = []) : void
46 {
47 $this->log(LogLevel::ERROR, $message, $context);
48 }
49 /**
50 * Exceptional occurrences that are not errors.
51 *
52 * Example: Use of deprecated APIs, poor use of an API, undesirable things
53 * that are not necessarily wrong.
54 */
55 public function warning(string|\Stringable $message, array $context = []) : void
56 {
57 $this->log(LogLevel::WARNING, $message, $context);
58 }
59 /**
60 * Normal but significant events.
61 */
62 public function notice(string|\Stringable $message, array $context = []) : void
63 {
64 $this->log(LogLevel::NOTICE, $message, $context);
65 }
66 /**
67 * Interesting events.
68 *
69 * Example: User logs in, SQL logs.
70 */
71 public function info(string|\Stringable $message, array $context = []) : void
72 {
73 $this->log(LogLevel::INFO, $message, $context);
74 }
75 /**
76 * Detailed debug information.
77 */
78 public function debug(string|\Stringable $message, array $context = []) : void
79 {
80 $this->log(LogLevel::DEBUG, $message, $context);
81 }
82 /**
83 * Logs with an arbitrary level.
84 *
85 * @param mixed $level
86 *
87 * @throws \Psr\Log\InvalidArgumentException
88 */
89 public abstract function log($level, string|\Stringable $message, array $context = []) : void;
90 }
91