Package astra.util

Class Logging


  • public class Logging
    extends Module
    This class provides a basic logger for ASTRA.

    Logging is a key debugging technique. This class exposes the Java Logging API to ASTRA. One log is created per agent (the id of the log is the agents name). and the standard suite of log levels is supported:

    • SEVERE
    • WARNING
    • OFF
    • ALL
    • FINE
    • FINER
    • FINEST
    • INFO

    When using a log level, case does not matter.

    Author:
    Rem Collier
    • Constructor Detail

      • Logging

        public Logging()
    • Method Detail

      • setAgent

        public void setAgent​(Agent agent)
        This is an internal (non-API) method that initialises the logger whose id is set to the agents name.
        Overrides:
        setAgent in class Module
        Parameters:
        agent - the agent instance
      • setLevel

        public boolean setLevel​(String level)
        Action to set the logging level.

        The logging level is one of: SEVERE, WARNING, OFF, ALL, FINE, FINER, FINEST, INFO

        Parameters:
        level - the logging level
        Returns:
        true if the action succeeds, false otherwise
      • log

        public boolean log​(String level,
                           String event)
        Action to record a log entry.

        Basic logging action. Combines the message with a log level

        Parameters:
        level - the logging level
        event - the message
        Returns:
        true if the action succeeds, false otherwise
      • severe

        public boolean severe​(String event)
        Action to record a SEVERE log event.
        Parameters:
        event - the event
        Returns:
        true if the action succeeds, false otherwise
      • warning

        public boolean warning​(String event)
        Action to record a WARNING log event.
        Parameters:
        event - the event
        Returns:
        true if the action succeeds, false otherwise
      • info

        public boolean info​(String event)
        Action to record a INFO log event.
        Parameters:
        event - the event
        Returns:
        true if the action succeeds, false otherwise
      • fine

        public boolean fine​(String event)
        Action to record a FINE log event.
        Parameters:
        event - the event
        Returns:
        true if the action succeeds, false otherwise
      • finer

        public boolean finer​(String event)
        Action to record a FINER log event.
        Parameters:
        event - the event
        Returns:
        true if the action succeeds, false otherwise
      • finest

        public boolean finest​(String event)
        Action to record a FINEST log event.
        Parameters:
        event - the event
        Returns:
        true if the action succeeds, false otherwise