Class LoggingUtils


  • public class LoggingUtils
    extends Object
    some utilities for consistent logging message creation in PLANit
    Author:
    markr
    • Constructor Summary

      Constructors 
      Constructor Description
      LoggingUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static String createDemandsPrefix​(long demandsId)
      Create a prefix for the logger so that all logging items specific to a particular demands are prefixed with the exact same string, i.e.
      static String createIterationPrefix​(int iterationIndex)
      Create a prefix for the logger so that all logging items specific to a particular traffic assignment run are prefixed with the exact same iteration string, i.e.
      static String createNetworkPrefix​(long networkId)
      Create a prefix for the logger so that all logging items specific to a particular network are prefixed with the exact same string, i.e.
      static String createOdPathSetsPrefix​(long odPathSetsId)
      Create a prefix for the logger so that all logging items specific to a particular od path sets are prefixed with the exact same string, i.e.
      static String createOutputFormatterPrefix​(long outputFormatterId)
      Create a prefix for the logger so that all logging items specific to a particular output formatters are prefixed with the exact same string, i.e.
      static String createProjectPrefix​(long projectId)
      Create a prefix for the logger so that all logging items specific to a particular project are prefixed with the exact same string, i.e.
      static String createRoutedServicesPrefix​(long routedServicesId)
      Create a prefix for the logger so that all logging items specific to a particular routed services are prefixed with the exact same string, i.e.
      static String createRunIdPrefix​(long runId)
      Create a prefix for the logger so that all logging items specific to a particular traffic assignment run are prefixed with the exact same string, i.e.
      static String createServiceNetworkPrefix​(long serviceNetworkId)
      Create a prefix for the logger so that all logging items specific to a particular service network are prefixed with the exact same string, i.e.
      static String createTimePeriodPrefix​(TimePeriod timePeriod)
      Create a prefix for the logger so that all logging items specific to a particular time period are prefixed with the exact same string, i.e.
      static String createZoningPrefix​(long zoningId)
      Create a prefix for the logger so that all logging items specific to a particular zoning are prefixed with the exact same string, i.e.
      static String getClassNameWithBrackets​(Object item)
      create a string that gets the class simple name and surrounds them with brackets
      static String logActiveStateByClassName​(Object item, boolean activate)
      create a string that states if item is activated or deactivated based and provide the simple class name
      static String surroundwithBrackets​(String message)
      Surround string with brackets "[%s]"
    • Constructor Detail

      • LoggingUtils

        public LoggingUtils()
    • Method Detail

      • surroundwithBrackets

        public static String surroundwithBrackets​(String message)
        Surround string with brackets "[%s]"
        Parameters:
        message - to surround with brackets
        Returns:
        bracketed string
      • createRunIdPrefix

        public static String createRunIdPrefix​(long runId)
        Create a prefix for the logger so that all logging items specific to a particular traffic assignment run are prefixed with the exact same string, i.e. [run id: <id> ]
        Parameters:
        runId - the run id
        Returns:
        runId prefix
      • createProjectPrefix

        public static String createProjectPrefix​(long projectId)
        Create a prefix for the logger so that all logging items specific to a particular project are prefixed with the exact same string, i.e. [project id: <id> ]
        Parameters:
        projectId - the project id
        Returns:
        project prefix
      • createNetworkPrefix

        public static String createNetworkPrefix​(long networkId)
        Create a prefix for the logger so that all logging items specific to a particular network are prefixed with the exact same string, i.e. [network id: <id> ]
        Parameters:
        networkId - the network id
        Returns:
        network prefix
      • createZoningPrefix

        public static String createZoningPrefix​(long zoningId)
        Create a prefix for the logger so that all logging items specific to a particular zoning are prefixed with the exact same string, i.e. [zoning id: <id> ]
        Parameters:
        zoningId - the zoning id
        Returns:
        zoning prefix
      • createDemandsPrefix

        public static String createDemandsPrefix​(long demandsId)
        Create a prefix for the logger so that all logging items specific to a particular demands are prefixed with the exact same string, i.e. [demands id: <id> ]
        Parameters:
        demandsId - the demands id
        Returns:
        demands prefix
      • createServiceNetworkPrefix

        public static String createServiceNetworkPrefix​(long serviceNetworkId)
        Create a prefix for the logger so that all logging items specific to a particular service network are prefixed with the exact same string, i.e. [services network id: <id> ]
        Parameters:
        serviceNetworkId - the id
        Returns:
        service network prefix
      • createRoutedServicesPrefix

        public static String createRoutedServicesPrefix​(long routedServicesId)
        Create a prefix for the logger so that all logging items specific to a particular routed services are prefixed with the exact same string, i.e. [routed services id: <id> ]
        Parameters:
        routedServicesId - the routed services id
        Returns:
        routed services prefix
      • createOdPathSetsPrefix

        public static String createOdPathSetsPrefix​(long odPathSetsId)
        Create a prefix for the logger so that all logging items specific to a particular od path sets are prefixed with the exact same string, i.e. [od path sets id: <id> ]
        Parameters:
        odPathSetsId - the odPathSets id
        Returns:
        od path sets Prefix
      • createOutputFormatterPrefix

        public static String createOutputFormatterPrefix​(long outputFormatterId)
        Create a prefix for the logger so that all logging items specific to a particular output formatters are prefixed with the exact same string, i.e. [output formatter id: <id> ]
        Parameters:
        outputFormatterId - the output formatter id
        Returns:
        output formatter prefix
      • createTimePeriodPrefix

        public static String createTimePeriodPrefix​(TimePeriod timePeriod)
        Create a prefix for the logger so that all logging items specific to a particular time period are prefixed with the exact same string, i.e. [time period : <external id> (id <id>) ]
        Parameters:
        timePeriod - the time period to create it for
        Returns:
        time period prefix
      • createIterationPrefix

        public static String createIterationPrefix​(int iterationIndex)
        Create a prefix for the logger so that all logging items specific to a particular traffic assignment run are prefixed with the exact same iteration string, i.e. [i=<id> ]
        Parameters:
        iterationIndex - the iteration index
        Returns:
        iteration prefix
      • logActiveStateByClassName

        public static String logActiveStateByClassName​(Object item,
                                                       boolean activate)
        create a string that states if item is activated or deactivated based and provide the simple class name
        Parameters:
        item - to (de)activate
        activate - indicate to activate or deactive
        Returns:
        the string (de)activated : <simple class name>
      • getClassNameWithBrackets

        public static String getClassNameWithBrackets​(Object item)
        create a string that gets the class simple name and surrounds them with brackets
        Parameters:
        item - to to apply
        Returns:
        the string [<class simple name>]