Skip to content

Commit 657a13e

Browse files
committed
feat(theme): add the Django theme
For coloring Django's logs.
1 parent 6e623e8 commit 657a13e

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

colout/colout_django.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
def theme(context):
3+
return context,[
4+
# Waiting
5+
["^Waiting for .*$", "red", "bold"],
6+
[".*Sending.*", "green"],
7+
# Watches
8+
["^(Watching) (\S*) (.*)", "yellow", "bold,bold,normal"],
9+
[".*reloading.$","yellow"],
10+
# File from python/lib
11+
["^(File) (/.*/lib/python[^/]*/site-packages/)([^/]*)\S* (first seen) (with mtime [0-9]*.*)$",
12+
"blue,blue,white,blue,blue", "bold,normal,bold,bold,normal"],
13+
# File from app (last 3 name highlighted)
14+
["^(File) (/\S*/)(\S*/\S*/)(\S*) (first seen) (with mtime [0-9]*.*)$",
15+
"magenta,magenta,white,white,magenta,magenta", "bold,normal,normal,bold,bold,normal"],
16+
# SQL
17+
["(.*)(SELECT)(.*)(FROM)(.*)",
18+
"green", "normal,bold,normal,bold,normal"],
19+
["(.*)(SELECT)(.*)(FROM)(.*)(WHERE)(.*)",
20+
"green", "normal,bold,normal,bold,normal,bold,normal"],
21+
# HTTP
22+
["\"(GET) (\S*) (HTTP\S*)\" ([0-9]+) (.*)$",
23+
"green,white,green,green,green", "bold,bold,normal,bold,normal"],
24+
# Errors
25+
["(Exception) (while .*) '(.*)' (in) (.*) '(.*)'", "red,red,white,red,red,white", "bold,normal,bold,bold,normal,bold"],
26+
["(.*Error): (.*) '(.*)'", "red,red,white", "bold,normal,bold"],
27+
["(django[^:\s]*)\.([^.:\s]*): (.*)", "red","normal,bold,normal"],
28+
["Traceback.*:","yellow"],
29+
["During handling.*","yellow"],
30+
# File, line, in
31+
[
32+
"^\s{2}(File \")(/*.*?/)*([^/:]+)(\", line) ([0-9]+)(, in) (.*)$",
33+
"blue, none, white,blue, yellow,blue",
34+
"normal,normal,bold, normal,normal,bold"
35+
],
36+
]

0 commit comments

Comments
 (0)