-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
50 lines (36 loc) · 984 Bytes
/
example.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import sys
import time
import pymongo
from monolg import Monolg
# Instantiating Monolg
# mlg = Monolg(verbose=True, system_log=True)
# mlg = Monolg('mongodb://localhost:27017', verbose=True, system_log=True)
# Connecting to locally running MongoDB
# mc = pymongo.MongoClient()
# mlg = Monolg(verbose=True)
mlg = Monolg(verbose=True)
mlg.clear_logs()
mlg.clear_sys_logs()
mlg.connect()
# mlg.close()
# mlg.close()
# mlg.reopen()
# sys.exit()
# mlg.clear_logs()
# mlg.clear_sys_logs()
# # Clearing any pre-existing logs
# # mlg.clear_logs()
# # Types of logs
# t1 = time.time()
mlg.log('This is a log log')
mlg.info('This is a info log')
mlg.warning('This is a warning log')
mlg.error('This is a error log')
mlg.critical('This is a critical log')
# print(time.time() - t1)
# # Closing the connection
mlg.close()
# # Reopenning connection
# mlg.reopen()
# # Logging again to check the if the connection is established
# mlg.info('This is after reopenning the connection',)