Although this is not quite what the OP wanted (each line coloured by level), I wanted to share a nice alternative for log output colouring called rich - a fantastic library for various rich text stuff to display in the terminal, authored by @will-mcgugan.
Simple example
Activating rich colouring for Django logs is easy: use rich.logging.RichHandler instead of logging.StreamHandler, e.g.
# project/settings.py
...
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'rich.logging.RichHandler', # <-- this
},
},
'root': {
'handlers': ['console'],
'level': 'INFO',
},
'loggers': {
'django': {
'handlers': ['console'],
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
'propagate': False,
},
},
}
(this is the modified example from Django logging docs). This will produce terminal logs like these:

Changing output format
Format customizations are done as usual by passing the handler arguments. E.g. to turn on rich tracebacks and hide the timestamp column:
LOGGING = {
...
'handlers': {
'console': {
'class': 'rich.logging.RichHandler',
'rich_tracebacks': True,
'show_time': False,
},
},
}
will yield

Changing output colours
Changing the colouring is possible, but not via logging config, as multiple colours and styles are applied to each line; you must provide a customized theme. An example that changes colouring of INFO label from the default blue to bold magenta:
import rich
import rich.theme
my_theme = rich.theme.Theme({
'logging.level.info': 'bold magenta',
})
rich.reconfigure(theme=my_theme)
LOGGING = {
... # no changes here
}
For more details, see Styles documentation. To inspect available theme keys and default values, issue
$ python -m rich.theme
and look for keys prefixed with log. or logging..
Outro
Note that rich is so much more than just coloured logging; go check it out:
$ python -m pip install rich
$ python -m rich
Specifically for the logging use case, check out the output of
$ python -m rich.logging
to see more rendering examples than in the screenshots.