Robot Core Documentation
Loading...
Searching...
No Matches
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, boolean noLogToConsole)
 
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,
boolean noLogToConsole )
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.
noLogToConsole- Specifies the this message should NOT be logged to che console.

◆ 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: