RobotCore
Robot Core Documentation
Classes | Static Public Member Functions | List of all members
robotCore.Logger Class Reference

The Logger class provides a mechanism to log messages. More...

Static Public Member Functions

static void Log (String tag, int level, String message)
 
static void SetLogLevel (int level)
 
static void SetLogLevel (String tag, int level)
 
static void SetLogFile (String name)
 
static void SetLogFile (String tag, String name)
 
static void SetLogFile (String tag, String name, boolean logTime)
 
static void SetLogFile (String tag, String name, boolean logTime, boolean logToConsole)
 
static void CloseLogFile ()
 
static void CloseLogFile (String tag)
 
static void CloseAllLogFiles ()
 
static long GetElapsedTime ()
 
static void ResetElapsedTime ()
 
static void StartLoggingServer ()
 

Detailed Description

The Logger class provides a mechanism to log messages.

Author
John Gaby

This class provides a mechanism to log messages to either the console or a file or both. The messages are tagged by a name and a logging level. There is a global setting for the minimum logging level of messages. Messages with a logging level less than the minimum will not be logged. The default global logging level is -999 (i.e. everything is logged)

In addition, each specific tag can have an independent minimum logging level which controls whether messages of that type are logged. The default logging level for specific tags is 0.

By default messages are logged to the console. However you can specify that the messages be logged to a file, or both a file and the console. You can set a global file which will log all messages that do not have their own file specified. You can also specify a separate file for each tag.

Member Function Documentation

◆ CloseAllLogFiles()

static void robotCore.Logger.CloseAllLogFiles ( )
static

Close all log files.

◆ CloseLogFile() [1/2]

static void robotCore.Logger.CloseLogFile ( )
static

Close the master log file

◆ CloseLogFile() [2/2]

static void robotCore.Logger.CloseLogFile ( String  tag)
static
Parameters
tag- Close the log file associated with messages with this tag.

◆ GetElapsedTime()

static long robotCore.Logger.GetElapsedTime ( )
static
Returns
Returns the time elapsed since the last call to ResetElapsedTime()

◆ Log()

static void robotCore.Logger.Log ( String  tag,
int  level,
String  message 
)
static
Parameters
tag- Specifies the tag for this message.
level- Specifies the logging level. If this value is less than the current minimum level, this message will not be logged.
message- Specifies the message to log.

◆ ResetElapsedTime()

static void robotCore.Logger.ResetElapsedTime ( )
static

Resets the elapsed time to zero

◆ SetLogFile() [1/4]

static void robotCore.Logger.SetLogFile ( String  name)
static
Parameters
name- Specifies a file name. All logs of messages that do not have their own individual log files will be written to this file

◆ SetLogFile() [2/4]

static void robotCore.Logger.SetLogFile ( String  tag,
String  name 
)
static
Parameters
tag- Specifies the tag that is to be logged to a file.
name- Specifies a file name. All logs that are tagged with this value will be logged to this file

Calls SetLogFile(tag, name, false)

◆ SetLogFile() [3/4]

static void robotCore.Logger.SetLogFile ( String  tag,
String  name,
boolean  logTime 
)
static
Parameters
tag- Specifies the tag that is to be logged to a file.
name- Specifies a file name. All logs that are tagged with this value will be logged to this file
logTime- If true, include the current time stamp for each logged line.

Calls SetLogFile(tag, name, logTime, false)

◆ SetLogFile() [4/4]

static void robotCore.Logger.SetLogFile ( String  tag,
String  name,
boolean  logTime,
boolean  logToConsole 
)
static
Parameters
tag- Specifies the tag that is to be logged to a file.
name- Specifies a file name. All logs that are tagged with this value will be logged to this file
logTime- If true, include the current time stamp for each logged line.
logToConsole- If true, log messages to the console as well as the file

◆ SetLogLevel() [1/2]

static void robotCore.Logger.SetLogLevel ( int  level)
static
Parameters
level- Specifies the global logging level. No messages less than this level will be logged, regardless of the logging level for the log type.

◆ SetLogLevel() [2/2]

static void robotCore.Logger.SetLogLevel ( String  tag,
int  level 
)
static
Parameters
tag- Specifies the tag for the log type for which the level is to be set.
level- Specifies the new logging level. For messages that are tagged with this tag, if the log level of the message is less than this value, the message will not be logged.

◆ StartLoggingServer()

static void robotCore.Logger.StartLoggingServer ( )
static

Starts a network server that can be contacted to receive the log strings. The server listens on port 5810.


The documentation for this class was generated from the following file: