to top
public class

LogRegistry

extends Object
implements ILogRegistry
java.lang.Object
   ↳ com.android.tradefed.log.LogRegistry

Class Overview

A ILogRegistry implementation that multiplexes and manages different loggers, using the appropriate one based on the ThreadGroup of the thread making the call.

Note that the registry hashes on the ThreadGroup in which a thread belongs. If a thread is spawned with its own explicitly-supplied ThreadGroup, it will not inherit the parent thread's logger, and thus will need to register its own logger with the LogRegistry if it wants to log output.

Summary

Public Methods
void closeAndRemoveAllLogs()
Closes and removes all logs being managed by this LogRegistry.
void dumpLogs()
Diagnosis method to dump all logs to files.
void dumpToGlobalLog(ILeveledLogOutput log)
Dumps the entire contents of a ILeveledLogOutput logger to the global log.
Log.LogLevel getGlobalLogDisplayLevel()
Returns current log level display for the global log
static ILogRegistry getLogRegistry()
Get the LogRegistry instance

void printAndPromptLog(Log.LogLevel logLevel, String tag, String message)
void printLog(Log.LogLevel logLevel, String tag, String message)
void registerLogger(ILeveledLogOutput log)
Registers the logger as the instance to use for the current thread.
void saveGlobalLog()
Saves global logger contents to a tmp file.
void setGlobalLogDisplayLevel(Log.LogLevel logLevel)
Set the log level display for the global log
void setGlobalLogTagDisplay(Collection<String> logTagsDisplay)
Set the log tags to display for the global log
void unregisterLogger()
Unregisters the current logger in effect for the current thread.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.ddmlib.Log.ILogOutput
From interface com.android.tradefed.log.ILogRegistry

Public Methods

public void closeAndRemoveAllLogs ()

Closes and removes all logs being managed by this LogRegistry.

public void dumpLogs ()

Diagnosis method to dump all logs to files.

public void dumpToGlobalLog (ILeveledLogOutput log)

Dumps the entire contents of a ILeveledLogOutput logger to the global log.

This is useful in scenarios where you know the logger's output won't be saved permanently, yet you want the contents to be saved somewhere and not lost.

public Log.LogLevel getGlobalLogDisplayLevel ()

Returns current log level display for the global log

Returns

public static ILogRegistry getLogRegistry ()

Get the LogRegistry instance

Returns
  • a LogRegistry that can be used to register, get, write to, and close logs

public void printAndPromptLog (Log.LogLevel logLevel, String tag, String message)

public void printLog (Log.LogLevel logLevel, String tag, String message)

public void registerLogger (ILeveledLogOutput log)

Registers the logger as the instance to use for the current thread.

public void saveGlobalLog ()

Saves global logger contents to a tmp file.

public void setGlobalLogDisplayLevel (Log.LogLevel logLevel)

Set the log level display for the global log

Parameters
logLevel the Log.LogLevel to use

public void setGlobalLogTagDisplay (Collection<String> logTagsDisplay)

Set the log tags to display for the global log

public void unregisterLogger ()

Unregisters the current logger in effect for the current thread.