Add timestamp in stdout logs
Closed this issue · 0 comments
tbittar commented
In order to improve the monitoring of Xpansion progress within AntaresWeb, we want to add 3 information before each bloc of log that is printed :
- Xpansion step (among Pre Antares, Antares, Problem Generation, Benders, Study Update)
- Timestamp (in the format as Simulator), in UTC time
- Type of the logs (info, warning, ....). Normally error logs are already redirected to stderr
An example of the logs could be :
[Pre Antares][<Info> 05-05-2023 11:06:36] Running Antares Xpansion ...
[Pre Antares][<Info> 05-05-2023 11:06:36] user: xxx
[Pre Antares][<Info> 05-05-2023 11:06:36] hostname: xxx
[Pre Antares][<Info> 05-05-2023 11:06:36] Xpansion version: 1.1.0
[Pre Antares][<Info> 05-05-2023 11:06:36] antares simulator version: 8.5.0
----------------------------------------------------------------
[Pre Antares][<Info> 05-05-2023 11:06:36] /my_study_directory is locked
[Pre Antares][<Info> 05-05-2023 11:06:36] -- pre antares
[Antares][<Info> 05-05-2023 11:06:36] -- launching antares
[Antares][<Info> 05-05-2023 11:06:36] Antares simulation duration : 0:00:03.759935
[Antares][<Info> 05-05-2023 11:06:36] -- post antares
[Antares][<Info> 05-05-2023 11:06:36] Current directory is now: /my_study_directory/output/20230505-1106eco-Xpansion/lp
[Problem Generation][<Info> 05-05-2023 11:06:36] Launching Problem Generation
[Problem Generation[<Info> 05-05-2023 11:06:42] Problem Generation ran in: 5 seconds
________________________________________________________________________
/
[Benders][<Info> 05-05-2023 11:06:36] Solving master...
[Benders][<Info> 05-05-2023 11:06:36] Master solved in 0.0222537 s
[Benders][<Info> 05-05-2023 11:06:36] ITERATION 1:
Candidates:
battery = 0.00 invested MW -- possible interval [0.00; 1000.00] MW
peak = 0.00 invested MW -- possible interval [0.00; 2000.00] MW
pv = 0.00 invested MW -- possible interval [0.00; 1000.00] MW
semibase = 0.00 invested MW -- possible interval [0.00; 2000.00] MW
transmission_line = 0.00 invested MW -- possible interval [0.00; 3200.00] MW
cumulative number of subproblem resolutions: 156
Subproblems solved in (cumulative cpu): 1.31792 s
Subproblems solved in (walltime): 0.15311 s
The format in the example is just a suggestion, any format that displays the required info suits the needs.