RobotCore 1.0
WPILib port to raspberry Pi
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 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.

Definition at line 53 of file Logger.java.

Member Function Documentation

◆ closeAllLogFiles()

void robotCore.Logger.closeAllLogFiles ( )
static

Close all log files.

Definition at line 337 of file Logger.java.

◆ closeLogFile() [1/2]

void robotCore.Logger.closeLogFile ( )
static

Close the master log file

Definition at line 309 of file Logger.java.

◆ closeLogFile() [2/2]

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

Definition at line 325 of file Logger.java.

◆ getElapsedTime()

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

Definition at line 354 of file Logger.java.

◆ log() [1/2]

void robotCore.Logger.log ( String tag,
int level,
String message )
static

Definition at line 218 of file Logger.java.

◆ log() [2/2]

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.

Definition at line 161 of file Logger.java.

◆ resetElapsedTime()

void robotCore.Logger.resetElapsedTime ( )
static

Resets the elapsed time to zero

Definition at line 366 of file Logger.java.

◆ setLogFile() [1/4]

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

Definition at line 251 of file Logger.java.

◆ setLogFile() [2/4]

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)

Definition at line 272 of file Logger.java.

◆ setLogFile() [3/4]

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)

Definition at line 286 of file Logger.java.

◆ setLogFile() [4/4]

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

Definition at line 298 of file Logger.java.

◆ setLogLevel() [1/2]

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.

Definition at line 226 of file Logger.java.

◆ setLogLevel() [2/2]

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.

Definition at line 239 of file Logger.java.

◆ startLoggingServer()

void robotCore.Logger.startLoggingServer ( )
static

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

Definition at line 395 of file Logger.java.


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