Package org.planit.utils.misc
Class LoggingUtils
- java.lang.Object
-
- org.planit.utils.misc.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
activateItemByClassName(Object item, boolean activate)
create a string that states if item is activated or deactivated based and provide the simple class namestatic 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
createOdRouteSetsPrefix(long odRouteSetsId)
Create a prefix for the logger so that all logging items specific to a particular od route 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
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
createTimePeriodPrefix(Object timePeriodExternalId, long timePeriodId)
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 bracketsstatic String
surroundwithBrackets(String message)
Surround string with brackets "[%s]"
-
-
-
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
-
createOdRouteSetsPrefix
public static String createOdRouteSetsPrefix(long odRouteSetsId)
Create a prefix for the logger so that all logging items specific to a particular od route sets are prefixed with the exact same string, i.e.[od route sets id: <id> ]
- Parameters:
odRouteSetsId
- the odRouteSets id- Returns:
- od route 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(Object timePeriodExternalId, long timePeriodId)
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:
timePeriodExternalId
- the time period's external idtimePeriodId
- the time period internal id- 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
-
activateItemByClassName
public static String activateItemByClassName(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)activateactivate
- indicate to activate or deactive- Returns:
- the string (de)activated :
<simple class name>
-
-