Class AKitLogger

java.lang.Object
xbot.common.advantage.AKitLogger

public class AKitLogger extends Object
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.
  • Constructor Details

  • Method Details

    • setGlobalLogLevel

      public static void setGlobalLogLevel(AKitLogger.LogLevel level)
      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

      public void withLogLevel(AKitLogger.LogLevel level, Runnable loggingCode)
      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 code
      loggingCode - code to run with the temporary log level
    • setLogLevel

      public void setLogLevel(AKitLogger.LogLevel level)
      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

      public AKitLogger.LogLevel getLogLevel()
      Get the log level for this particular logger instance.
      Returns:
      the log level for this particular logger instance
    • setPrefix

      public void setPrefix(String prefix)
      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

      public void record(String key, byte[] value)
    • record

      public void record(String key, boolean value)
    • record

      public void record(String key, int value)
    • record

      public void record(String key, long value)
    • record

      public void record(String key, float value)
    • record

      public void record(String key, double value)
    • record

      public void record(String key, String value)
    • record

      public <E extends Enum<E>> void record(String key, E value)
    • record

      public <U extends Unit> void record(String key, Measure<U> value)
    • record

      public void record(String key, boolean[] value)
    • record

      public void record(String key, int[] value)
    • record

      public void record(String key, long[] value)
    • record

      public void record(String key, float[] value)
    • record

      public void record(String key, double[] value)
    • record

      public void record(String key, String[] value)
    • record

      public <T> void record(String key, Struct<T> struct, T value)
    • record

      public <T> void record(String key, Struct<T> struct, T... value)
    • record

      public <T, MessageType extends us.hebi.quickbuf.ProtoMessage<?>> void record(String key, Protobuf<T,MessageType> proto, T value)
    • recordOutput

      public <T extends StructSerializable> void recordOutput(String key, T[][] value)
    • record

      public <T extends StructSerializable> void record(String key, T... value)
    • record

      public <T extends WPISerializable> void record(String key, T value)
    • record

      public void record(String key, org.littletonrobotics.junction.mechanism.LoggedMechanism2d value)