Coverage Report - com.allanbank.mongodb.util.log.Log
 
Classes in this File Line Coverage Branch Coverage Complexity
Log
N/A
N/A
1
 
 1  
 /*
 2  
  * #%L
 3  
  * Log.java - mongodb-async-driver - Allanbank Consulting, Inc.
 4  
  * %%
 5  
  * Copyright (C) 2011 - 2014 Allanbank Consulting, Inc.
 6  
  * %%
 7  
  * Licensed under the Apache License, Version 2.0 (the "License");
 8  
  * you may not use this file except in compliance with the License.
 9  
  * You may obtain a copy of the License at
 10  
  * 
 11  
  *      http://www.apache.org/licenses/LICENSE-2.0
 12  
  * 
 13  
  * Unless required by applicable law or agreed to in writing, software
 14  
  * distributed under the License is distributed on an "AS IS" BASIS,
 15  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 16  
  * See the License for the specific language governing permissions and
 17  
  * limitations under the License.
 18  
  * #L%
 19  
  */
 20  
 package com.allanbank.mongodb.util.log;
 21  
 
 22  
 import java.util.logging.Level;
 23  
 
 24  
 /**
 25  
  * Log is the simplified logging interface used by the driver. It will
 26  
  * dynamically wrap either SLF4J (if available) or Java Util Logging (as a
 27  
  * fall-back).
 28  
  * 
 29  
  * @api.no This class is <b>NOT</b> part of the drivers API. This class may be
 30  
  *         mutated in incompatible ways between any two releases of the driver.
 31  
  * @copyright 2014, Allanbank Consulting, Inc., All Rights Reserved
 32  
  */
 33  
 public interface Log {
 34  
     /**
 35  
      * The token to replace with the arguments to the log message. Unlike SLF4J
 36  
      * we do support escaping of this token.
 37  
      */
 38  
     public static final String REPLACE_TOKEN = "{}";
 39  
 
 40  
     /**
 41  
      * Logs a message at the {@link Level#FINE DEBUG} level.
 42  
      * 
 43  
      * @param message
 44  
      *            The message to log.
 45  
      */
 46  
     public void debug(String message);
 47  
 
 48  
     /**
 49  
      * Logs a message at the DEBUG level.
 50  
      * 
 51  
      * @param template
 52  
      *            The message template to log.
 53  
      * @param args
 54  
      *            The arguments to replace the <code>{}</code> entries in the
 55  
      *            template.
 56  
      */
 57  
     public void debug(String template, Object... args);
 58  
 
 59  
     /**
 60  
      * Logs a message at the DEBUG level.
 61  
      * 
 62  
      * @param thrown
 63  
      *            The exception associated with the log message.
 64  
      * @param template
 65  
      *            The message template to log.
 66  
      * @param args
 67  
      *            The arguments to replace the <code>{}</code> entries in the
 68  
      *            template.
 69  
      */
 70  
     public void debug(Throwable thrown, String template, Object... args);
 71  
 
 72  
     /**
 73  
      * Logs a message at the {@link Level#SEVERE ERROR} level.
 74  
      * 
 75  
      * @param message
 76  
      *            The message to log.
 77  
      */
 78  
     public void error(String message);
 79  
 
 80  
     /**
 81  
      * Logs a message at the ERROR level.
 82  
      * 
 83  
      * @param template
 84  
      *            The message template to log.
 85  
      * @param args
 86  
      *            The arguments to replace the <code>{}</code> entries in the
 87  
      *            template.
 88  
      */
 89  
     public void error(String template, Object... args);
 90  
 
 91  
     /**
 92  
      * Logs a message at the ERROR level.
 93  
      * 
 94  
      * @param thrown
 95  
      *            The exception associated with the log message.
 96  
      * @param template
 97  
      *            The message template to log.
 98  
      * @param args
 99  
      *            The arguments to replace the <code>{}</code> entries in the
 100  
      *            template.
 101  
      */
 102  
     public void error(Throwable thrown, String template, Object... args);
 103  
 
 104  
     /**
 105  
      * Logs a message at the {@link Level#INFO} level.
 106  
      * 
 107  
      * @param message
 108  
      *            The message to log.
 109  
      */
 110  
     public void info(String message);
 111  
 
 112  
     /**
 113  
      * Logs a message at the INFO level.
 114  
      * 
 115  
      * @param template
 116  
      *            The message template to log.
 117  
      * @param args
 118  
      *            The arguments to replace the <code>{}</code> entries in the
 119  
      *            template.
 120  
      */
 121  
     public void info(String template, Object... args);
 122  
 
 123  
     /**
 124  
      * Logs a message at the INFO level.
 125  
      * 
 126  
      * @param thrown
 127  
      *            The exception associated with the log message.
 128  
      * @param template
 129  
      *            The message template to log.
 130  
      * @param args
 131  
      *            The arguments to replace the <code>{}</code> entries in the
 132  
      *            template.
 133  
      */
 134  
     public void info(Throwable thrown, String template, Object... args);
 135  
 
 136  
     /**
 137  
      * Logs a message at the specified level.
 138  
      * 
 139  
      * @param level
 140  
      *            The logging level for the message.
 141  
      * @param message
 142  
      *            The message to log.
 143  
      */
 144  
     public void log(Level level, String message);
 145  
 
 146  
     /**
 147  
      * Logs a message at the specified level.
 148  
      * 
 149  
      * @param level
 150  
      *            The logging level for the message.
 151  
      * @param template
 152  
      *            The message template to log.
 153  
      * @param args
 154  
      *            The arguments to replace the <code>{}</code> entries in the
 155  
      *            template.
 156  
      */
 157  
     public void log(Level level, String template, Object... args);
 158  
 
 159  
     /**
 160  
      * Logs a message at the specified level.
 161  
      * 
 162  
      * @param level
 163  
      *            The logging level for the message.
 164  
      * @param thrown
 165  
      *            The exception associated with the log message.
 166  
      * @param template
 167  
      *            The message template to log.
 168  
      * @param args
 169  
      *            The arguments to replace the <code>{}</code> entries in the
 170  
      *            template.
 171  
      */
 172  
     public void log(Level level, Throwable thrown, String template,
 173  
             Object... args);
 174  
 
 175  
     /**
 176  
      * Logs a message at the {@link Level#WARNING} level.
 177  
      * 
 178  
      * @param message
 179  
      *            The message to log.
 180  
      */
 181  
     public void warn(String message);
 182  
 
 183  
     /**
 184  
      * Logs a message at the WARNING level.
 185  
      * 
 186  
      * @param template
 187  
      *            The message template to log.
 188  
      * @param args
 189  
      *            The arguments to replace the <code>{}</code> entries in the
 190  
      *            template.
 191  
      */
 192  
     public void warn(String template, Object... args);
 193  
 
 194  
     /**
 195  
      * Logs a message at the WARNING level.
 196  
      * 
 197  
      * @param thrown
 198  
      *            The exception associated with the log message.
 199  
      * @param template
 200  
      *            The message template to log.
 201  
      * @param args
 202  
      *            The arguments to replace the <code>{}</code> entries in the
 203  
      *            template.
 204  
      */
 205  
     public void warn(Throwable thrown, String template, Object... args);
 206  
 
 207  
 }