xref: /plugin/smtp/vendor/psr/log/Psr/Log/NullLogger.php (revision ee5c02056e482f4a07fb4b075ec45c4dfd3de0e8)
1*ee5c0205SAndreas Gohr<?php
2*ee5c0205SAndreas Gohr
3*ee5c0205SAndreas Gohrnamespace Psr\Log;
4*ee5c0205SAndreas Gohr
5*ee5c0205SAndreas Gohr/**
6*ee5c0205SAndreas Gohr * This Logger can be used to avoid conditional log calls.
7*ee5c0205SAndreas Gohr *
8*ee5c0205SAndreas Gohr * Logging should always be optional, and if no logger is provided to your
9*ee5c0205SAndreas Gohr * library creating a NullLogger instance to have something to throw logs at
10*ee5c0205SAndreas Gohr * is a good way to avoid littering your code with `if ($this->logger) { }`
11*ee5c0205SAndreas Gohr * blocks.
12*ee5c0205SAndreas Gohr */
13*ee5c0205SAndreas Gohrclass NullLogger extends AbstractLogger
14*ee5c0205SAndreas Gohr{
15*ee5c0205SAndreas Gohr    /**
16*ee5c0205SAndreas Gohr     * Logs with an arbitrary level.
17*ee5c0205SAndreas Gohr     *
18*ee5c0205SAndreas Gohr     * @param mixed  $level
19*ee5c0205SAndreas Gohr     * @param string $message
20*ee5c0205SAndreas Gohr     * @param array  $context
21*ee5c0205SAndreas Gohr     *
22*ee5c0205SAndreas Gohr     * @return void
23*ee5c0205SAndreas Gohr     *
24*ee5c0205SAndreas Gohr     * @throws \Psr\Log\InvalidArgumentException
25*ee5c0205SAndreas Gohr     */
26*ee5c0205SAndreas Gohr    public function log($level, $message, array $context = array())
27*ee5c0205SAndreas Gohr    {
28*ee5c0205SAndreas Gohr        // noop
29*ee5c0205SAndreas Gohr    }
30*ee5c0205SAndreas Gohr}
31