View Javadoc

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;
18  
19  import java.io.Serializable;
20  
21  /**
22   *  Markers are objects that are used to add easily filterable information to log messages.
23   *
24   *  Markers can be hierarchical - each Marker may have a parent. This allows for broad categories
25   *  being subdivided into more specific categories. An example might be a Marker named "Error" with
26   *  children named "SystemError" and "ApplicationError".
27   */
28  public interface Marker extends Serializable {
29  
30      /**
31       * Returns the name of this Marker.
32       * @return The name of the Marker.
33       */
34      String getName();
35  
36      /**
37       * Returns the parent of this Marker.
38       * @return The parent Marker or null if this Marker has no parent.
39       */
40      Marker getParent();
41  
42      /**
43       * Checks whether this Marker is an instance of the specified Marker.
44       * @param m The Marker to check.
45       * @return true of this Marker or one of its ancestors is the specified Marker, false otherwise.
46       */
47      boolean isInstanceOf(Marker m);
48  
49      /**
50       * Checks whether this Marker is an instance of the specified Marker.
51       * @param name The name of the Marker.
52       * @return true of this Marker or one of its ancestors matches the specified name, false otherwise.
53       */
54      boolean isInstanceOf(String name);
55  }