[18220] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 4 | * contributor license agreements. See the NOTICE file distributed with |
---|
| 5 | * this work for additional information regarding copyright ownership. |
---|
| 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 7 | * (the "License"); you may not use this file except in compliance with |
---|
| 8 | * the License. You may obtain a copy of the License at |
---|
| 9 | * |
---|
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 11 | * |
---|
| 12 | * Unless required by applicable law or agreed to in writing, software |
---|
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 15 | * See the License for the specific language governing permissions and |
---|
| 16 | * limitations under the License. |
---|
| 17 | * |
---|
| 18 | * |
---|
| 19 | * @package log4php |
---|
| 20 | * @subpackage layouts |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | /** |
---|
| 24 | * @ignore |
---|
| 25 | */ |
---|
| 26 | if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..'); |
---|
| 27 | |
---|
| 28 | if (!defined('LOG4PHP_LINE_SEP')) { |
---|
| 29 | if (substr(php_uname(), 0, 7) == "Windows") { |
---|
| 30 | define('LOG4PHP_LINE_SEP', "\r\n"); |
---|
| 31 | } else { |
---|
| 32 | /** |
---|
| 33 | * @ignore |
---|
| 34 | */ |
---|
| 35 | define('LOG4PHP_LINE_SEP', "\n"); |
---|
| 36 | } |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | /** |
---|
| 41 | */ |
---|
| 42 | require_once(LOG4PHP_DIR . '/LoggerLayout.php'); |
---|
| 43 | |
---|
| 44 | /** |
---|
| 45 | * A simple layout. |
---|
| 46 | * |
---|
| 47 | * Returns the log statement in a format consisting of the |
---|
| 48 | * <b>level</b>, followed by " - " and then the <b>message</b>. |
---|
| 49 | * For example, |
---|
| 50 | * <samp> INFO - "A message" </samp> |
---|
| 51 | * |
---|
| 52 | * @author Marco Vassura |
---|
| 53 | * @version $Revision: 635069 $ |
---|
| 54 | * @package log4php |
---|
| 55 | * @subpackage layouts |
---|
| 56 | */ |
---|
| 57 | class LoggerLayoutSimple extends LoggerLayout { |
---|
| 58 | |
---|
| 59 | /** |
---|
| 60 | * Constructor |
---|
| 61 | */ |
---|
| 62 | function LoggerLayoutSimple() |
---|
| 63 | { |
---|
| 64 | return; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | function activateOptions() |
---|
| 68 | { |
---|
| 69 | return; |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | /** |
---|
| 73 | * Returns the log statement in a format consisting of the |
---|
| 74 | * <b>level</b>, followed by " - " and then the |
---|
| 75 | * <b>message</b>. For example, |
---|
| 76 | * <samp> INFO - "A message" </samp> |
---|
| 77 | * |
---|
| 78 | * @param LoggerLoggingEvent $event |
---|
| 79 | * @return string |
---|
| 80 | */ |
---|
| 81 | function format($event) |
---|
| 82 | { |
---|
| 83 | $level = $event->getLevel(); |
---|
| 84 | return $level->toString() . ' - ' . $event->getRenderedMessage(). LOG4PHP_LINE_SEP; |
---|
| 85 | } |
---|
| 86 | } |
---|