From 657a13eee19df8661ba9cd0c63895ee96640049b Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 14 Feb 2023 09:08:12 +0100 Subject: [PATCH] feat(theme): add the Django theme For coloring Django's logs. --- colout/colout_django.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 colout/colout_django.py diff --git a/colout/colout_django.py b/colout/colout_django.py new file mode 100644 index 0000000..e6ca473 --- /dev/null +++ b/colout/colout_django.py @@ -0,0 +1,36 @@ + +def theme(context): + return context,[ + # Waiting + ["^Waiting for .*$", "red", "bold"], + [".*Sending.*", "green"], + # Watches + ["^(Watching) (\S*) (.*)", "yellow", "bold,bold,normal"], + [".*reloading.$","yellow"], + # File from python/lib + ["^(File) (/.*/lib/python[^/]*/site-packages/)([^/]*)\S* (first seen) (with mtime [0-9]*.*)$", + "blue,blue,white,blue,blue", "bold,normal,bold,bold,normal"], + # File from app (last 3 name highlighted) + ["^(File) (/\S*/)(\S*/\S*/)(\S*) (first seen) (with mtime [0-9]*.*)$", + "magenta,magenta,white,white,magenta,magenta", "bold,normal,normal,bold,bold,normal"], + # SQL + ["(.*)(SELECT)(.*)(FROM)(.*)", + "green", "normal,bold,normal,bold,normal"], + ["(.*)(SELECT)(.*)(FROM)(.*)(WHERE)(.*)", + "green", "normal,bold,normal,bold,normal,bold,normal"], + # HTTP + ["\"(GET) (\S*) (HTTP\S*)\" ([0-9]+) (.*)$", + "green,white,green,green,green", "bold,bold,normal,bold,normal"], + # Errors + ["(Exception) (while .*) '(.*)' (in) (.*) '(.*)'", "red,red,white,red,red,white", "bold,normal,bold,bold,normal,bold"], + ["(.*Error): (.*) '(.*)'", "red,red,white", "bold,normal,bold"], + ["(django[^:\s]*)\.([^.:\s]*): (.*)", "red","normal,bold,normal"], + ["Traceback.*:","yellow"], + ["During handling.*","yellow"], + # File, line, in + [ + "^\s{2}(File \")(/*.*?/)*([^/:]+)(\", line) ([0-9]+)(, in) (.*)$", + "blue, none, white,blue, yellow,blue", + "normal,normal,bold, normal,normal,bold" + ], + ]