Overview

Namespaces

  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Collection
      • Constants
      • Exceptions
      • Http
        • Message
      • Log
      • Resource
      • Service
    • Compute
      • Constants
      • Exception
      • Resource
    • Database
      • Resource
    • DNS
      • Collection
      • Resource
    • Identity
      • Constants
      • Resource
    • Image
      • Enum
      • Resource
        • JsonPatch
        • Schema
    • LoadBalancer
      • Enum
      • Resource
    • ObjectStore
      • Constants
      • Exception
      • Resource
      • Upload
    • Orchestration
    • Queues
      • Exception
      • Resource
    • Volume
      • Resource
  • PHP

Classes

  • AbstractLogger
  • Logger
  • LogLevel

Interfaces

  • LoggerInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Download
  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:  * Copyright (c) 2012 PHP Framework Interoperability Group
 19:  *
 20:  * Permission is hereby granted, free of charge, to any person obtaining a copy
 21:  * of this software and associated documentation files (the "Software"), to deal
 22:  * in the Software without restriction, including without limitation the rights
 23:  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 24:  * copies of the Software, and to permit persons to whom the Software is
 25:  * furnished to do so, subject to the following conditions:
 26:  *
 27:  * The above copyright notice and this permission notice shall be included in
 28:  * all copies or substantial portions of the Software.
 29:  *
 30:  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 31:  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 32:  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 33:  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 34:  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 35:  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 36:  */
 37: 
 38: namespace OpenCloud\Common\Log;
 39: 
 40: /**
 41:  * This is a simple Logger implementation that other Loggers can inherit from.
 42:  *
 43:  * It simply delegates all log-level-specific methods to the `log` method to
 44:  * reduce boilerplate code that a simple Logger that does the same thing with
 45:  * messages regardless of the error level has to implement.
 46:  */
 47: abstract class AbstractLogger implements LoggerInterface
 48: {
 49:     /**
 50:      * System is unusable.
 51:      *
 52:      * @param string $message
 53:      * @param array  $context
 54:      * @return null
 55:      */
 56:     public function emergency($message, array $context = array())
 57:     {
 58:         $this->log(LogLevel::EMERGENCY, $message, $context);
 59:     }
 60: 
 61:     /**
 62:      * Action must be taken immediately.
 63:      *
 64:      * Example: Entire website down, database unavailable, etc. This should
 65:      * trigger the SMS alerts and wake you up.
 66:      *
 67:      * @param string $message
 68:      * @param array  $context
 69:      * @return null
 70:      */
 71:     public function alert($message, array $context = array())
 72:     {
 73:         $this->log(LogLevel::ALERT, $message, $context);
 74:     }
 75: 
 76:     /**
 77:      * Critical conditions.
 78:      *
 79:      * Example: Application component unavailable, unexpected exception.
 80:      *
 81:      * @param string $message
 82:      * @param array  $context
 83:      * @return null
 84:      */
 85:     public function critical($message, array $context = array())
 86:     {
 87:         $this->log(LogLevel::CRITICAL, $message, $context);
 88:     }
 89: 
 90:     /**
 91:      * Runtime errors that do not require immediate action but should typically
 92:      * be logged and monitored.
 93:      *
 94:      * @param string $message
 95:      * @param array  $context
 96:      * @return null
 97:      */
 98:     public function error($message, array $context = array())
 99:     {
100:         $this->log(LogLevel::ERROR, $message, $context);
101:     }
102: 
103:     /**
104:      * Exceptional occurrences that are not errors.
105:      *
106:      * Example: Use of deprecated APIs, poor use of an API, undesirable things
107:      * that are not necessarily wrong.
108:      *
109:      * @param string $message
110:      * @param array  $context
111:      * @return null
112:      */
113:     public function warning($message, array $context = array())
114:     {
115:         $this->log(LogLevel::WARNING, $message, $context);
116:     }
117: 
118:     /**
119:      * Normal but significant events.
120:      *
121:      * @param string $message
122:      * @param array  $context
123:      * @return null
124:      */
125:     public function notice($message, array $context = array())
126:     {
127:         $this->log(LogLevel::NOTICE, $message, $context);
128:     }
129: 
130:     /**
131:      * Interesting events.
132:      *
133:      * Example: User logs in, SQL logs.
134:      *
135:      * @param string $message
136:      * @param array  $context
137:      * @return null
138:      */
139:     public function info($message, array $context = array())
140:     {
141:         $this->log(LogLevel::INFO, $message, $context);
142:     }
143: 
144:     /**
145:      * Detailed debug information.
146:      *
147:      * @param string $message
148:      * @param array  $context
149:      * @return null
150:      */
151:     public function debug($message, array $context = array())
152:     {
153:         $this->log(LogLevel::DEBUG, $message, $context);
154:     }
155: }
156: 
PHP OpenCloud API API documentation generated by ApiGen 2.8.0