Package io.github.frc5024.lib5k.logging
Class RobotLogger
- java.lang.Object
-
- io.github.frc5024.lib5k.logging.RobotLogger
-
@FieldTested(year=2019) @Tested @TestedInSimulation public class RobotLogger extends java.lang.Object
A threaded logger for use by all robot functions
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RobotLogger.Level
Log level The kRobot level will immediately push to the console, everything else is queued until the next notifier cycle
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
enableUSBLogging(USBLogger logger)
Enable logging to a USBvoid
flush()
Manually flush the logs (only use this in unit tests)static RobotLogger
getInstance()
Get a RobotLogger instanceprotected static java.lang.String
getPackageName(java.lang.StackTraceElement element)
Gets a friendly package name for a StackTraceElementvoid
log(java.lang.String msg, RobotLogger.Level lvl, java.lang.Object... args)
Write a log message to the logfile and message buffer.void
log(java.lang.String msg, java.lang.Object... args)
Write a log message to the logfile and message buffer.void
log(java.lang.String component, java.lang.String msg)
Deprecated.void
log(java.lang.String component, java.lang.String msg, RobotLogger.Level log_level)
Deprecated.void
start(double period)
Start the periodic logger
-
-
-
Method Detail
-
enableUSBLogging
public void enableUSBLogging(USBLogger logger)
Enable logging to a USB- Parameters:
logger
- USB logger object
-
start
public void start(double period)
Start the periodic logger- Parameters:
period
- The logging notifier period time in seconds
-
getInstance
public static RobotLogger getInstance()
Get a RobotLogger instance- Returns:
- The current RobotLogger
-
log
public void log(java.lang.String msg, java.lang.Object... args)
Write a log message to the logfile and message buffer.- Parameters:
msg
- Log message (String.format style)args
- Format arguments
-
log
public void log(java.lang.String msg, RobotLogger.Level lvl, java.lang.Object... args)
Write a log message to the logfile and message buffer.- Parameters:
msg
- Log message (String.format style)lvl
- Log levelargs
- Format arguments
-
log
@Deprecated(since="July 2020", forRemoval=false) public void log(java.lang.String component, java.lang.String msg)
Deprecated.Write a log message to the logfile and message buffer. This is deprecated, and acts as a binding for old programs.- Parameters:
component
- Calling component namemsg
- Log message
-
log
@Deprecated(since="July 2020", forRemoval=false) public void log(java.lang.String component, java.lang.String msg, RobotLogger.Level log_level)
Deprecated.Write a log message to the logfile and message buffer. This is deprecated, and acts as a binding for old programs.- Parameters:
component
- Calling component namemsg
- Log messagelog_level
- Log level
-
getPackageName
protected static java.lang.String getPackageName(java.lang.StackTraceElement element)
Gets a friendly package name for a StackTraceElement- Parameters:
element
- Element to get name for- Returns:
- Friendly Name
-
flush
public void flush()
Manually flush the logs (only use this in unit tests)
-
-