Skip to content

Commit e04aa5e

Browse files
committed
Colored console locally and plain console in production
1 parent b489113 commit e04aa5e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

readthedocs/settings/base.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,17 @@ def DOCKER_LIMITS(self):
806806
"()": structlog.stdlib.ProcessorFormatter,
807807
"processors": [
808808
structlog.stdlib.ProcessorFormatter.remove_processors_meta,
809-
structlog.dev.ConsoleRenderer(),
809+
structlog.dev.ConsoleRenderer(colors=False),
810+
],
811+
# Allows to add extra data to log entries generated via ``logging`` module
812+
# See https://www.structlog.org/en/stable/standard-library.html#rendering-using-structlog-based-formatters-within-logging
813+
"foreign_pre_chain": shared_processors,
814+
},
815+
"colored_console": {
816+
"()": structlog.stdlib.ProcessorFormatter,
817+
"processors": [
818+
structlog.stdlib.ProcessorFormatter.remove_processors_meta,
819+
structlog.dev.ConsoleRenderer(colors=True),
810820
],
811821
# Allows to add extra data to log entries generated via ``logging`` module
812822
# See https://www.structlog.org/en/stable/standard-library.html#rendering-using-structlog-based-formatters-within-logging

readthedocs/settings/docker_compose.py

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def RTD_EMBED_API_EXTERNAL_DOMAINS(self):
7777
@property
7878
def LOGGING(self):
7979
logging = super().LOGGING
80+
logging['handlers']['console']['formatter'] = 'colored_console'
8081
logging['loggers'].update({
8182
# Disable Django access requests logging (e.g. GET /path/to/url)
8283
# https://github.com/django/django/blob/ca9872905559026af82000e46cde6f7dedc897b6/django/core/servers/basehttp.py#L24

0 commit comments

Comments
 (0)