3 namespace Friendica\Util\Logger;
5 use Friendica\Core\System;
6 use Friendica\Util\Profiler;
7 use Psr\Log\LoggerInterface;
10 * This Logger adds additional profiling data in case profiling is enabled.
11 * It uses a predefined logger.
13 class ProfilerLogger implements LoggerInterface
16 * The Logger of the current call
17 * @var LoggerInterface
22 * The Profiler for the current call
28 * ProfilerLogger constructor.
29 * @param LoggerInterface $logger The Logger of the current call
30 * @param Profiler $profiler The profiler of the current call
32 public function __construct(LoggerInterface $logger, Profiler $profiler)
34 $this->logger = $logger;
35 $this->profiler = $profiler;
41 public function emergency($message, array $context = array())
43 $stamp1 = microtime(true);
44 $this->logger->emergency($message, $context);
45 $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
51 public function alert($message, array $context = array())
53 $stamp1 = microtime(true);
54 $this->logger->alert($message, $context);
55 $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
61 public function critical($message, array $context = array())
63 $stamp1 = microtime(true);
64 $this->logger->critical($message, $context);
65 $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
71 public function error($message, array $context = array())
73 $stamp1 = microtime(true);
74 $this->logger->error($message, $context);
75 $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
81 public function warning($message, array $context = array())
83 $stamp1 = microtime(true);
84 $this->logger->warning($message, $context);
85 $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
91 public function notice($message, array $context = array())
93 $stamp1 = microtime(true);
94 $this->logger->notice($message, $context);
95 $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
101 public function info($message, array $context = array())
103 $stamp1 = microtime(true);
104 $this->logger->info($message, $context);
105 $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
111 public function debug($message, array $context = array())
113 $stamp1 = microtime(true);
114 $this->logger->debug($message, $context);
115 $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
121 public function log($level, $message, array $context = array())
123 $stamp1 = microtime(true);
124 $this->logger->log($level, $message, $context);
125 $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());