Class RobotLogger

    • 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 USB
      void flush()
      Manually flush the logs (only use this in unit tests)
      static RobotLogger getInstance()
      Get a RobotLogger instance
      protected static java.lang.String getPackageName​(java.lang.StackTraceElement element)
      Gets a friendly package name for a StackTraceElement
      void 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 level
        args - 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 name
        msg - 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 name
        msg - Log message
        log_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)