Skip to content

Commit 6efc0bc

Browse files
authored
Merge pull request #33 from TTWShell/feature/logging
Feature/logging
2 parents fc1b892 + 3ba325f commit 6efc0bc

File tree

5 files changed

+48
-4
lines changed

5 files changed

+48
-4
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[loggers]
2+
keys=root, gunicorn.error, gunicorn.access
3+
4+
[handlers]
5+
keys=console, file
6+
7+
8+
[formatters]
9+
keys=timedRotatingFormatter
10+
11+
[formatter_timedRotatingFormatter]
12+
format=%(asctime)s pid:%(process)d - %(levelname)s: %(message)s
13+
datefmt=%Y-%m-%d %H:%M:%S
14+
15+
16+
[logger_root]
17+
level=NOTSET
18+
handlers=console, file
19+
qualname=root
20+
21+
[logger_gunicorn.error]
22+
level=INFO
23+
handlers=console, file
24+
propagate=1
25+
qualname=gunicorn.error
26+
27+
[logger_gunicorn.access]
28+
level=INFO
29+
handlers=console, file
30+
propagate=0
31+
qualname=gunicorn.access
32+
33+
34+
[handler_console]
35+
level=INFO
36+
class=StreamHandler
37+
formatter=timedRotatingFormatter
38+
args=(sys.stdout, )
39+
40+
[handler_file]
41+
level=DEBUG
42+
class=handlers.TimedRotatingFileHandler
43+
args=('logs/gunicorn.log', 'D', 1, 30)

hobbit_core/hobbit/static/bootstrap/shire/docker-compose.yml.jinja2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ services:
1717
networks:
1818
- web_nw
1919
command:
20-
bash -c "flask db upgrade && gunicorn -k gevent -w 4 -b 0.0.0.0:5000 app.run:app"
20+
bash -c "flask db upgrade &&
21+
gunicorn --log-config configs/gunicorn-logging.ini -k gevent -w 4 -b 0.0.0.0:5000 app.run:app"
2122

2223
networks:
2324
web_nw:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def gen_data(data_root='hobbit/static/bootstrap'):
2121

2222

2323
package_data = gen_data()
24-
assert len(package_data) == 27, \
24+
assert len(package_data) == 28, \
2525
'nums of tepl files error, {}'.format(len(package_data))
2626

2727

tests/test_hobbit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_startproject_cmd_example(self):
8686
'--echo', 'startproject', '-n', 'haha', '--example',
8787
'-p', '1024',
8888
], obj={})
89-
# start + 27 files + 10 dir + 1 end + empty
90-
assert len(result.output.split('\n')) == 1 + 10 + 27 + 1 + 1
89+
# start + 28 files + 11 dir + 1 end + empty
90+
assert len(result.output.split('\n')) == 1 + 28 + 11 + 1 + 1
9191
assert result.exit_code == 0
9292
assert 'example.py' in result.output

0 commit comments

Comments
 (0)