-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.py
More file actions
28 lines (21 loc) · 797 Bytes
/
Copy pathutils.py
File metadata and controls
28 lines (21 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import logging
class Logger(object):
def __init__(self):
for i in ('requests', 'urllib3', 'tweepy'):
logging.getLogger(i).setLevel(logging.WARNING)
format = ('[{filename:>16}:{lineno:<4} {funcName:>16}()] ' +
'{asctime}: {message}')
logging.basicConfig(format=format,
style='{',
datefmt='%Y-%m-%d %H:%M:%S',
level=logging.INFO)
self.logger = logging.getLogger(__name__)
self.logger.info('Logger initialised.')
def get_logger(self):
return self.logger
logger = Logger().get_logger()
def ellipsis(text, max_length):
if len(text) > max_length:
return text[:max_length - 1] + '…'
else:
return text