multiscale / muscle3

The third major version of the MUltiScale Coupling Library and Environment
Apache License 2.0
25 stars 13 forks source link

Add timestamps to component log files #176

Open maarten-ic opened 1 year ago

maarten-ic commented 1 year ago

Add an option to set prepend application output with a timestamp. E.g. log_timestamps: true in the implementations section

For example, instead of the log output:

Hello world! Let's sleep 10 seconds...
Awake again!
Jan 31 13:25:21 Hello world! Let's sleep 10 seconds...
Jan 31 13:25:31 Awake again!

(The latter can be obtained when ts from the package moreutils is installed like so: python -u -c "print('Hello world! Let\\'s sleep 10 seconds...'); import time; time.sleep(10); print('Awake again!')" | ts

Note: when using python, this will only work correctly when using the -u command line flag or setting the environment variable PYTHONUNBUFFERED=1

This also requires support from qcg-pilotjob before muscle3 can support it.