      1: <?php
      2: /**
      3:  * Copyright 2012-2014 Rackspace US, Inc.
      4:  *
      5:  * Licensed under the Apache License, Version 2.0 (the "License");
      6:  * you may not use this file except in compliance with the License.
      7:  * You may obtain a copy of the License at
      8:  *
      9:  * http://www.apache.org/licenses/LICENSE-2.0
     10:  *
     11:  * Unless required by applicable law or agreed to in writing, software
     12:  * distributed under the License is distributed on an "AS IS" BASIS,
     13:  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14:  * See the License for the specific language governing permissions and
     15:  * limitations under the License.
     16:  */
     17:
     18: namespace OpenCloud\Common\Log;
     19:
     20: /**
     21:  * Describes a logger instance
     22:  *
     23:  * The message MUST be a string or object implementing __toString().
     24:  *
     25:  * The message MAY contain placeholders in the form: {foo} where foo
     26:  * will be replaced by the context data in key "foo".
     27:  *
     28:  * The context array can contain arbitrary data, the only assumption that
     29:  * can be made by implementors is that if an Exception instance is given
     30:  * to produce a stack trace, it MUST be in a key named "exception".
     31:  *
     32:  * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
     33:  * for the full interface specification.
     34:  */
     35: interface LoggerInterface
     36: {
     37:     /**
     38:      * System is unusable.
     39:      *
     40:      * @param string $message
     41:      * @param array  $context
     42:      * @return null
     43:      */
     44:     public function emergency($message, array $context = array());
     45:
     46:     /**
     47:      * Action must be taken immediately.
     48:      *
     49:      * Example: Entire website down, database unavailable, etc. This should
     50:      * trigger the SMS alerts and wake you up.
     51:      *
     52:      * @param string $message
     53:      * @param array  $context
     54:      * @return null
     55:      */
     56:     public function alert($message, array $context = array());
     57:
     58:     /**
     59:      * Critical conditions.
     60:      *
     61:      * Example: Application component unavailable, unexpected exception.
     62:      *
     63:      * @param string $message
     64:      * @param array  $context
     65:      * @return null
     66:      */
     67:     public function critical($message, array $context = array());
     68:
     69:     /**
     70:      * Runtime errors that do not require immediate action but should typically
     71:      * be logged and monitored.
     72:      *
     73:      * @param string $message
     74:      * @param array  $context
     75:      * @return null
     76:      */
     77:     public function error($message, array $context = array());
     78:
     79:     /**
     80:      * Exceptional occurrences that are not errors.
     81:      *
     82:      * Example: Use of deprecated APIs, poor use of an API, undesirable things
     83:      * that are not necessarily wrong.
     84:      *
     85:      * @param string $message
     86:      * @param array  $context
     87:      * @return null
     88:      */
     89:     public function warning($message, array $context = array());
     90:
     91:     /**
     92:      * Normal but significant events.
     93:      *
     94:      * @param string $message
     95:      * @param array  $context
     96:      * @return null
     97:      */
     98:     public function notice($message, array $context = array());
     99:
    100:     /**
    101:      * Interesting events.
    102:      *
    103:      * Example: User logs in, SQL logs.
    104:      *
    105:      * @param string $message
    106:      * @param array  $context
    107:      * @return null
    108:      */
    109:     public function info($message, array $context = array());
    110:
    111:     /**
    112:      * Detailed debug information.
    113:      *
    114:      * @param string $message
    115:      * @param array  $context
    116:      * @return null
    117:      */
    118:     public function debug($message, array $context = array());
    119:
    120:     /**
    121:      * Logs with an arbitrary level.
    122:      *
    123:      * @param mixed  $level
    124:      * @param string $message
    125:      * @param array  $context
    126:      * @return null
    127:      */
    128:     public function log($level, $message, array $context = array());
    129: }
    130: