18 private LoggerInterface $logger;
24 private function getLogger(): LoggerInterface {
30 private function formatLogEntry(
string $msg, array $context = [] ): array {
31 $prefix = $this->getType();
32 if ( isset( $this->title ) ) {
33 $prefix .=
' [{job_title}]';
34 $context[
'job_title'] = $this->title->getPrefixedText();
37 return [
"$prefix: $msg", $context ];
40 protected function logDebug(
string $msg, array $context = [] ):
void {
41 [ $msg, $context ] = $this->formatLogEntry( $msg, $context );
42 $this->getLogger()->debug( $msg, $context );
45 protected function logInfo(
string $msg, array $context = [] ):
void {
46 [ $msg, $context ] = $this->formatLogEntry( $msg, $context );
47 $this->getLogger()->info( $msg, $context );
50 protected function logNotice(
string $msg, array $context = [] ):
void {
51 [ $msg, $context ] = $this->formatLogEntry( $msg, $context );
52 $this->getLogger()->notice( $msg, $context );
55 protected function logWarning(
string $msg, array $context = [] ):
void {
56 [ $msg, $context ] = $this->formatLogEntry( $msg, $context );
57 $this->getLogger()->warning( $msg, $context );
60 protected function logError(
string $msg, array $context = [] ):
void {
61 [ $msg, $context ] = $this->formatLogEntry( $msg, $context );
62 $this->getLogger()->error( $msg, $context );