In package com.caseyjbrooks.clog
public class ClogProfile extends IClog
Constructors
public ClogProfile()
Initialize Clog with the default configuration, using a simple logger and the Parseltongue formatter
- No parameters
public ClogProfile(Map<String, ClogLogger> loggers, ClogFormatter formatter)
Initialize a custom Clog instance to be used as a custom profile
-
Map<String, ClogLogger> loggers
-
ClogFormatter formatter
Methods
public String getStackTraceString(Throwable tr)
Handy function to get a loggable stack trace from a Throwable. Copied from the Android Open Source Project Log.java class.
-
Throwable tr
An exception to log
public String format(String message, Object args)
-
String message
-
Object args
public int loggerInternal(String logger, String message, Throwable throwable, Object args)
-
String logger
-
String message
-
Throwable throwable
-
Object args
public Map<String, ClogLogger> getLoggers()
Get the loggers for the current profile
- No parameters
public List<String> getLoggerKeys()
Get the keys for all loggers in the current profile
- No parameters
public void setLoggers(Map<String, ClogLogger> loggers)
Replace all loggers in the current profile with a new set
-
Map<String, ClogLogger> loggers
the new map of loggers
public void addLogger(String key, ClogLogger logger)
Add a new logger to the current profile, replacing any existing logger already set with the key
-
String key
the logger key
-
ClogLogger logger
the logger to add or replace
public void removeLogger(String key)
Remove the logger at the specified key from the current profile
-
String key
the key mapping to the logger to be removed
public void setFormatter(ClogFormatter formatter)
Set the Clog formatter implementation to be used in the current profile
-
ClogFormatter formatter
the formatter implementation to use
public ClogFormatter getFormatter()
Get the Clog formatter implementation used in the current profile
- No parameters
public String getLastTag()
Get the tag from the most recently logged message in the current profile. Mostly used for testing.
- No parameters
public String getLastLog()
Get the most recently logged message in the current profile. Mostly used for testing.
- No parameters
public void flush()
Flushes the last tag and last log from the current profile. Mostly used for testing.
- No parameters
public void addTagToWhitelist(String tag)
Adds the tag to a whitelist. Only logging messages whose tag is in the whitelist will be logged. If the whitelist is empty, no tag whitelist filtering will be done.
-
String tag
the tag to whitelist
public void addTagToBlacklist(String tag)
Adds the tag to a blacklist. Only logging messages whose tag is not in the blacklist will be logged. If the blacklist is empty, no tag blacklist filtering will be done.
-
String tag
the tag to blacklist
public void clearTagWhitelist()
Clears the tag whitelist of all entries.
- No parameters
public void clearTagBlacklist()
Clears the tag blacklist of all entries.
- No parameters
public void addLoggerToWhitelist(String tag)
Adds the logger to a whitelist. Only logging messages whose logger is in the whitelist will be logged. If the whitelist is empty, no logger whitelist filtering will be done.
-
String tag
the tag to whitelist
public void addLoggerToBlacklist(String tag)
Adds the tag to a blacklist. Only logging messages whose logger is not in the blacklist will be logged. If the blacklist is empty, no logger blacklist filtering will be done.
-
String tag
the tag to blacklist
public void clearLoggerWhitelist()
Clears the logger whitelist of all entries.
- No parameters
public void clearLoggerBlacklist()
Clears the logger blacklist of all entries.
- No parameters
public void setMinPriority(Priority minPriority)
Sets the minimum priority of loggers to log messages from
-
Priority minPriority
the minimum priority to log
public void setMaxPriority(Priority maxPriority)
Sets the maximum priority of loggers to log messages from
-
Priority maxPriority
the maximum priority to log
public void pushTag(String tag)
Set the tag to use for subsequent logging calls. Be sure to push the tag as close the logging call as possible, and to pop this tag off the stack when finished.
-
String tag
the tag to use
public void popTag()
Remove the latest tag from the tag stack.
- No parameters
public String getCurrentTag()
Remove the current tag from the tag stack.
- No parameters
protected boolean isClassnameInternal(String className)
-
String className