Skip to content

Commit 1e85b46

Browse files
committed
add logging.py
1 parent fccc271 commit 1e85b46

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

13.system/logging.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
def logging(func):
3+
import sys
4+
def _deco():
5+
try:
6+
func()
7+
except Exception as e:
8+
with open("run.log", "a") as f:
9+
sys.print_exception(e, f)
10+
return _deco
11+
12+
@logging
13+
def bar():
14+
print('this is test output run.log')
15+
c = e
16+
17+
bar()

0 commit comments

Comments
 (0)