Skip to content

Commit fd69db6

Browse files
authored
Merge pull request #201 from carmocca/patch-3
Include the envvar RANK with structured logging
2 parents cbab037 + 5625faf commit fd69db6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

flogging/flogging.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ def emit(self, record: logging.LogRecord):
219219
"thread": reduce_thread_id(record.thread),
220220
"name": record.name,
221221
}
222+
try:
223+
rank = os.environ["RANK"]
224+
except KeyError:
225+
pass
226+
else:
227+
obj["RANK"] = rank
222228
if record.exc_info is not None:
223229
try:
224230
obj["error"] = traceback.format_exception(*record.exc_info)[1:]

0 commit comments

Comments
 (0)