Skip to content

Commit fe0122e

Browse files
committed
changed gitignore
1 parent dbd2431 commit fe0122e

26 files changed

+12393
-0
lines changed

amr_suite/py3-Smatch-and-S2match/smatch/.ipynb_checkpoints/amr_py3-checkpoint.py

Lines changed: 427 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import logging
2+
3+
4+
def get_logger(i):
5+
ch = logging.StreamHandler()
6+
logger = logging.getLogger("app")
7+
if i == 1:
8+
logger.setLevel(logging.DEBUG)
9+
ch.setLevel(logging.DEBUG)
10+
if i == 2:
11+
logger.setLevel(logging.INFO)
12+
ch.setLevel(logging.INFO)
13+
if i == 3:
14+
logger.setLevel(logging.WARNING)
15+
ch.setLevel(logging.WARNING)
16+
if i == 4:
17+
logger.setLevel(logging.ERROR)
18+
ch.setLevel(logging.ERROR)
19+
if i == 5:
20+
logger.setLevel(logging.CRITICAL)
21+
ch.setLevel(logging.CRITICAL)
22+
logger.addHandler(ch)
23+
return logger
24+
25+
class LogHelper:
26+
27+
def __init__(self, loglevel=5):
28+
self.logger = get_logger(loglevel)
29+
self.ll = loglevel
30+
return None
31+
32+
def debug(self,*args):
33+
if self.ll != 1:
34+
return None
35+
#first is the msg second are potentially non-string args
36+
msg = str(args[0])
37+
print(args,",")
38+
if len(args) == 1:
39+
self.logger.debug(msg)
40+
else:
41+
string = ""
42+
for arg in args[1:]:
43+
string+=str(arg)+" "
44+
string=string.strip()
45+
self.logger.debug(msg+": {}".format(string))
46+
return None
47+
48+
def info(self,*args):
49+
if self.ll != 2:
50+
return None
51+
#first is the msg second are potentially non-string args
52+
msg = str(args[0])
53+
if len(args) == 1:
54+
self.logger.info(msg)
55+
else:
56+
string = ""
57+
for arg in args[1:]:
58+
string+=str(arg)+" "
59+
string=string.strip()
60+
self.logger.info(msg+": {}".format(string))
61+
return None
62+
63+
def warning(self,*args):
64+
if self.ll != 3:
65+
return None
66+
#first is the msg second are potentially non-string args
67+
msg = str(args[0])
68+
if len(args) == 1:
69+
self.logger.warning(msg)
70+
else:
71+
string = ""
72+
for arg in args[1:]:
73+
string+=str(arg)+" "
74+
string=string.strip()
75+
self.logger.warning(msg+": {}".format(string))
76+
return None
77+
78+
def error(self,*args):
79+
#first is the msg second are potentially non-string args
80+
if self.ll != 4:
81+
return None
82+
msg = str(args[0])
83+
if len(args) == 1:
84+
self.logger.error(msg)
85+
else:
86+
string = ""
87+
for arg in args[1:]:
88+
string+=str(arg)+" "
89+
string=string.strip()
90+
self.logger.error(msg+": {}".format(string))
91+
return None
92+
93+
def critical(self,*args):
94+
if self.ll !=5:
95+
return None
96+
#first is the msg second are potentially non-string args
97+
msg = str(args[0])
98+
if len(args) == 1:
99+
self.logger.critical(msg)
100+
else:
101+
string = ""
102+
for arg in args[1:]:
103+
string+=str(arg)+" "
104+
string=string.strip()
105+
self.logger.critical(msg+": {}".format(string))
106+
return None

0 commit comments

Comments
 (0)