1 //
2 //  ========================================================================
3 //  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
4 //  ------------------------------------------------------------------------
5 //  All rights reserved. This program and the accompanying materials
6 //  are made available under the terms of the Eclipse Public License v1.0
7 //  and Apache License v2.0 which accompanies this distribution.
8 //
9 //      The Eclipse Public License is available at
10 //      http://www.eclipse.org/legal/epl-v10.html
11 //
12 //      The Apache License v2.0 is available at
13 //      http://www.opensource.org/licenses/apache2.0.php
14 //
15 //  You may elect to redistribute this code under either of these licenses.
16 //  ========================================================================
17 //
18 
19 package org.eclipse.jetty.util.log;
20 
21 /**
22  * A simple logging facade that is intended simply to capture the style of logging as used by Jetty.
23  */
24 public interface Logger
25 {
26     /**
27      * @return the name of this logger
28      */
getName()29     public String getName();
30 
31     /**
32      * Formats and logs at warn level.
33      * @param msg the formatting string
34      * @param args the optional arguments
35      */
warn(String msg, Object... args)36     public void warn(String msg, Object... args);
37 
38     /**
39      * Logs the given Throwable information at warn level
40      * @param thrown the Throwable to log
41      */
warn(Throwable thrown)42     public void warn(Throwable thrown);
43 
44     /**
45      * Logs the given message at warn level, with Throwable information.
46      * @param msg the message to log
47      * @param thrown the Throwable to log
48      */
warn(String msg, Throwable thrown)49     public void warn(String msg, Throwable thrown);
50 
51     /**
52      * Formats and logs at info level.
53      * @param msg the formatting string
54      * @param args the optional arguments
55      */
info(String msg, Object... args)56     public void info(String msg, Object... args);
57 
58     /**
59      * Logs the given Throwable information at info level
60      * @param thrown the Throwable to log
61      */
info(Throwable thrown)62     public void info(Throwable thrown);
63 
64     /**
65      * Logs the given message at info level, with Throwable information.
66      * @param msg the message to log
67      * @param thrown the Throwable to log
68      */
info(String msg, Throwable thrown)69     public void info(String msg, Throwable thrown);
70 
71     /**
72      * @return whether the debug level is enabled
73      */
isDebugEnabled()74     public boolean isDebugEnabled();
75 
76     /**
77      * Mutator used to turn debug on programmatically.
78      * @param enabled whether to enable the debug level
79      */
setDebugEnabled(boolean enabled)80     public void setDebugEnabled(boolean enabled);
81 
82     /**
83      * Formats and logs at debug level.
84      * @param msg the formatting string
85      * @param args the optional arguments
86      */
debug(String msg, Object... args)87     public void debug(String msg, Object... args);
88 
89     /**
90      * Logs the given Throwable information at debug level
91      * @param thrown the Throwable to log
92      */
debug(Throwable thrown)93     public void debug(Throwable thrown);
94 
95     /**
96      * Logs the given message at debug level, with Throwable information.
97      * @param msg the message to log
98      * @param thrown the Throwable to log
99      */
debug(String msg, Throwable thrown)100     public void debug(String msg, Throwable thrown);
101 
102     /**
103      * @param name the name of the logger
104      * @return a logger with the given name
105      */
getLogger(String name)106     public Logger getLogger(String name);
107 
108     /**
109      * Ignore an exception.
110      * <p>This should be used rather than an empty catch block.
111      */
ignore(Throwable ignored)112     public void ignore(Throwable ignored);
113 }
114