KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > log > format > RawFormatter


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.log.format;
18
19 import org.apache.log.LogEvent;
20
21 /**
22  * Basic formatter that just returns raw
23  * message string and ignores remainder of LogEvent.
24  *
25  * @author Peter Donald
26  */

27 public class RawFormatter
28     implements Formatter
29 {
30     /**
31      * Format log event into string.
32      *
33      * @param event the event
34      * @return the formatted string
35      */

36     public String JavaDoc format( final LogEvent event )
37     {
38         final String JavaDoc message = event.getMessage();
39         if( null == message )
40         {
41             return "";
42         }
43         else
44         {
45             return message;
46         }
47     }
48 }
49
Popular Tags