1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache license, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. 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 package org.apache.logging.log4j.core.pattern;
18
19 /**
20 * Interface that all PatternConverters must implement.
21 */
22 public interface PatternConverter {
23
24 /**
25 * Main plugin category for PatternConverter plugins.
26 *
27 * @since 2.1
28 */
29 String CATEGORY = "Converter";
30
31 /**
32 * Formats an object into a string buffer.
33 *
34 * @param obj event to format, may not be null.
35 * @param toAppendTo string buffer to which the formatted event will be appended. May not be null.
36 */
37 void format(Object obj, StringBuilder toAppendTo);
38
39 /**
40 * Returns the name of the converter.
41 * @return The name of the converter.
42 */
43 String getName();
44
45 /**
46 * This method returns the CSS style class that should be applied to
47 * the LoggingEvent passed as parameter, which can be null.
48 *
49 * @param e null values are accepted
50 * @return the name of the conversion pattern
51 */
52 String getStyleClass(Object e);
53 }