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

Parameters:
  • No parameters
public ClogProfile(Map<String, ClogLogger> loggers, ClogFormatter formatter)

Initialize a custom Clog instance to be used as a custom profile

Parameters:

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.

Parameters:
  • Throwable tr

    An exception to log

public String format(String message, Object args)
Parameters:
  • String message
  • Object args
public int loggerInternal(String logger, String message, Throwable throwable, Object args)
Parameters:
  • String logger
  • String message
  • Throwable throwable
  • Object args
public Map<String, ClogLogger> getLoggers()

Get the loggers for the current profile

Parameters:
  • No parameters
public List<String> getLoggerKeys()

Get the keys for all loggers in the current profile

Parameters:
  • No parameters
public void setLoggers(Map<String, ClogLogger> loggers)

Replace all loggers in the current profile with a new set

Parameters:
  • 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

Parameters:
  • 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

Parameters:
  • 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

Parameters:
public ClogFormatter getFormatter()

Get the Clog formatter implementation used in the current profile

Parameters:
  • No parameters
public String getLastTag()

Get the tag from the most recently logged message in the current profile. Mostly used for testing.

Parameters:
  • No parameters
public String getLastLog()

Get the most recently logged message in the current profile. Mostly used for testing.

Parameters:
  • No parameters
public void flush()

Flushes the last tag and last log from the current profile. Mostly used for testing.

Parameters:
  • 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.

Parameters:
  • 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.

Parameters:
  • String tag

    the tag to blacklist

public void clearTagWhitelist()

Clears the tag whitelist of all entries.

Parameters:
  • No parameters
public void clearTagBlacklist()

Clears the tag blacklist of all entries.

Parameters:
  • 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.

Parameters:
  • 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.

Parameters:
  • String tag

    the tag to blacklist

public void clearLoggerWhitelist()

Clears the logger whitelist of all entries.

Parameters:
  • No parameters
public void clearLoggerBlacklist()

Clears the logger blacklist of all entries.

Parameters:
  • No parameters
public void setMinPriority(Priority minPriority)

Sets the minimum priority of loggers to log messages from

Parameters:
  • Priority minPriority

    the minimum priority to log

public void setMaxPriority(Priority maxPriority)

Sets the maximum priority of loggers to log messages from

Parameters:
  • Priority maxPriority

    the maximum priority to log

public ClogProfile tag(String tag)
Parameters:
  • String tag
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.

Parameters:
  • String tag

    the tag to use

public void popTag()

Remove the latest tag from the tag stack.

Parameters:
  • No parameters
public String getCurrentTag()

Remove the current tag from the tag stack.

Parameters:
  • No parameters
protected boolean isClassnameInternal(String className)
Parameters:
  • String className