forked from ebubekirtabak/PySloth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.py
More file actions
24 lines (17 loc) · 799 Bytes
/
logger.py
File metadata and controls
24 lines (17 loc) · 799 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
import time
import os
from modules.file_module import FileModule
script_dir = os.path.dirname(__file__)
class Logger:
def __init__(self):
pass
def set_log(self, data):
abs_file_path = os.path.join(script_dir, 'log.txt')
with open(abs_file_path, 'a') as the_file:
the_file.write( str(time.strftime('%c')) + " : " + data)
the_file.write('\n')
def set_error_log(self, data):
print("Error:" + data)
FileModule().write_file_line(script_dir, file_name='error_log.txt', line='Error: ' + str(time.strftime('%c')) + " : " + data)
def set_memory_log(self, data):
FileModule().write_file_line(script_dir, file_name='memory_logs/error_log' + str(time.time()) + '.txt', line=str(time.strftime('%c')) + " : " + data)