Package xbot.common.advantage
Class AKitLogger
java.lang.Object
xbot.common.advantage.AKitLogger
AKitLogger is a wrapper around the AdvantageKit Logger that adds some extra functionality, such as log levels and prefixes.
The log level functionality allows you to control how much logging is sent to the network table, which can be useful for reducing network traffic.
The prefix functionality allows you to easily organize your logs in the network table by subsystem or other categories.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the log level for this particular logger instance.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoid<E extends Enum<E>>
void<U extends Unit>
void<T,MessageType extends us.hebi.quickbuf.ProtoMessage<?>>
void<T> void<T> voidvoidvoidvoid<T extends WPISerializable>
void<T extends StructSerializable>
void<T extends StructSerializable>
voidrecordOutput(String key, T[][] value) static voidThis controls the log level for all AKitLoggers.voidsetLogLevel(AKitLogger.LogLevel level) Set the log level for this particular logger instance.voidChanges the log prefix.protected booleanvoidwithLogLevel(AKitLogger.LogLevel level, Runnable loggingCode) Temporarily changes the log level for this logger while running the provided code.
-
Constructor Details
-
AKitLogger
-
AKitLogger
-
-
Method Details
-
setGlobalLogLevel
This controls the log level for all AKitLoggers. This will generally be set to INFO during competitions so that debug logs are not sent to the network table.- Parameters:
level- new level to set
-
withLogLevel
Temporarily changes the log level for this logger while running the provided code. This is useful for cases where you want to log something at a different level than the rest of the logger's logs.- Parameters:
level- log level to use while running the provided codeloggingCode- code to run with the temporary log level
-
setLogLevel
Set the log level for this particular logger instance. Log calls made after this will have that level when checking if they should record or not.- Parameters:
level- new level to set
-
getLogLevel
Get the log level for this particular logger instance.- Returns:
- the log level for this particular logger instance
-
setPrefix
Changes the log prefix. May be needed for subsystems that have the same name, such as multiple instances of the Swerve modules.- Parameters:
prefix- logging prefix, should end with a "/"
-
shouldSkipLogging
protected boolean shouldSkipLogging() -
record
-
record
-
record
-
record
-
record
-
record
-
record
-
record
-
record
-
record
-
record
-
record
-
record
-
record
-
record
-
record
-
record
-
record
-
recordOutput
-
record
-
record
-
record
-