PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / trunk
ووسلام – همگام سازی ووکامرس و باسلام vtrunk
1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 1.8.5 1.8.6 1.8.7 1.8.4 All 51 releases
sync-basalam / includes / Logger / Logger.php

Logger.php in ووسلام – همگام سازی ووکامرس و باسلام trunk, at includes/Logger/Logger.php

68 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SyncBasalam\Logger;
4
5 defined('ABSPATH') || exit;
6
7 class Logger
8 {
9 private static $instance = [];
10 private $logger;
11
12 private function __construct($channel)
13 {
14 if ($channel == "woo" && class_exists('WC_Logger')) {
15 $this->logger = new WooLogger();
16 }
17 }
18
19 public static function getInstance($channel = "woo")
20 {
21 if (!isset(self::$instance[$channel])) {
22 self::$instance[$channel] = new self($channel);
23 }
24
25 return self::$instance[$channel];
26 }
27
28 public static function channel($channel)
29 {
30 return self::getInstance($channel)->logger;
31 }
32
33 public static function log($level, $message, $context = [])
34 {
35 self::getInstance()->logger->log($level, $message, $context);
36 }
37
38 public static function info($message, $context = [])
39 {
40 self::getInstance()->logger->info($message, $context);
41 }
42
43 public static function debug($message, $context = [])
44 {
45 self::getInstance()->logger->debug($message, $context);
46 }
47
48 public static function warning($message, $context = [])
49 {
50 self::getInstance()->logger->warning($message, $context);
51 }
52
53 public static function error($message, $context = [])
54 {
55 self::getInstance()->logger->error($message, $context);
56 }
57
58 public static function alert($message, $context = [])
59 {
60 self::getInstance()->logger->alert($message, $context);
61 }
62
63 public static function getLogs()
64 {
65 return self::getInstance()->logger->getLogs();
66 }
67 }
68