Logger Library
Chainrisk has implemented its logger system to ensure consistent and well-structured logs. The logs will majorly be used for debugging purposes.
The Logger is executed at all major steps during the simulation flow as well as when encountered with errors. Schema of the Log:
{
simResultID: String,
log: String,
obj: {},
type: String,
}
There are 3 types of logs:
info:- Used to informational logs; eg: “Executing Harvest Agent”. This is the default log type.
warn:- Used to inform users of possible improvements in code.
error:- Used to inform users of error resulting in code exiting
How to call logs?
info:-
log.info(
"Simulation Started",
{
name: name,
startedAt: startedAt,
},
simID
);
warn:-
log.warn(
"Possible empty object",
{
name: objectName,
},
simID
);
error:-
log.error(
"Simulation Failed",
{
simID: simID,
instanceSimOf: instanceSimId,
},
simID
)
Last updated