-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlog.py
33 lines (27 loc) · 900 Bytes
/
log.py
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
29
30
31
32
33
import time
import datetime
class Logger:
"""
output: {time} - {prefix} {info}
"""
def __init__(self, prefix):
self.prefix = prefix
def log(self, info):
print('{} - {} / {}'.format(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), self.prefix, info))
@staticmethod
def err(e):
print('{} - Error: {}'.format(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), e))
SenderLogger = Logger('Sender')
ReceiverLogger = Logger('Receiver')
ClientLogger = Logger('Client')
ServerLogger = Logger('Server')
FileLogger = Logger('File')
RwndLogger = Logger('Rwnd')
CwndLogger = Logger('Cwnd')
ThreadLogger = Logger('Thread')
SendStateLogger = Logger('SendState')
CongestionSateLogger = Logger('CongestionSate')
SSThreshLogger = Logger('SSThresh')
WriteLogger = Logger('WriteData')
SendSeqLogger = Logger('SendSeq')
RecvSeqLogger = Logger('RecvSeq')