Skip to content

Commit

Permalink
feat(theme): add the Django theme
Browse files Browse the repository at this point in the history
For coloring Django's logs.
  • Loading branch information
nojhan committed Feb 14, 2023
1 parent 6e623e8 commit 657a13e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions colout/colout_django.py
Original file line number Diff line number Diff line change
@@ -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"
],
]

0 comments on commit 657a13e

Please sign in to comment.