Skip to content

Commit 456d249

Browse files
authored
feat: add app version to file logs (#201)
Signed-off-by: Anupam Kumar <[email protected]>
1 parent ebae8ce commit 456d249

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

context_chat_backend/logger.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
import os
1313
from time import gmtime
1414

15+
from dotenv import load_dotenv
1516
from ruamel.yaml import YAML
1617

18+
load_dotenv()
19+
1720
__all__ = ['JSONFormatter', 'setup_logging']
1821

1922
LOG_RECORD_BUILTIN_ATTRS = {
@@ -62,6 +65,7 @@ def _prepare_log_dict(self, record: logging.LogRecord):
6265
"timestamp": dt.datetime.fromtimestamp(
6366
record.created, tz=dt.UTC,
6467
).isoformat(),
68+
"version": os.getenv("APP_VERSION", "unknown"),
6569
}
6670
if record.exc_info is not None:
6771
always_fields["exc_info"] = self.formatException(record.exc_info)

0 commit comments

Comments
 (0)