Skip to content

Commit a58e98c

Browse files
committed
wip: granian logging
1 parent b987d80 commit a58e98c

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

granian-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
env_file:
66
- .env
77
- .secrets
8-
command: granian --interface asgi --host 0.0.0.0 --port 8080 --loop uvloop app.main:app
8+
command: granian --interface asgi --host 0.0.0.0 --port 8080 --loop uvloop app.main:app --log-level debug
99
volumes:
1010
- .:/home/code
1111
ports:

logging-config.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"version": 1,
3+
"disable_existing_loggers": false,
4+
"formatters": {
5+
"default": {
6+
"format": "[%(process)d|%(name)-12s] %(message)s",
7+
"class": "logging.Formatter"
8+
}
9+
},
10+
"handlers": {
11+
"console": {
12+
"class": "app.utils.logging.RichConsoleHandler",
13+
"level": "DEBUG",
14+
"formatter": "default",
15+
"stream": "ext://sys.stdout",
16+
"kwargs": {"omit_repeated_times": "True", "show_time": "False", "enable_link_path": "False", "tracebacks_show_locals": "True", "rich_tracebacks": "True"},
17+
"args": "(100, 'white')"
18+
19+
},
20+
"sqlalchemy": {
21+
// "class": "logging.handlers.TimedRotatingFileHandler",
22+
// "level": "DEBUG",
23+
// "formatter": "verbose",
24+
// "when": "D",
25+
// "backupCount": 0,
26+
// "filename": "./logs/training-stats.log"
27+
},
28+
"granian": {
29+
// "class": "logging.handlers.TimedRotatingFileHandler",
30+
// "level": "DEBUG",
31+
// "formatter": "verbose",
32+
// "when": "D",
33+
// "backupCount": 0,
34+
// "filename": "./logs/uvicorn.log"
35+
}
36+
},
37+
"loggers": {
38+
"root": {
39+
// "level": "DEBUG",
40+
// "handlers": ["console"]
41+
},
42+
"sqlalchemy.engine.Engine": {
43+
// "level": "DEBUG",
44+
// "handlers": ["file"],
45+
// "propagate": true,
46+
// "qualname": "app"
47+
},
48+
"granian.access": {
49+
// "level": "DEBUG",
50+
// "handlers": ["uvicorn"],
51+
// "propagate": true,
52+
// "qualname": "uvicorn"
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)