Skip to content

Commit

Permalink
changed log name and some output
Browse files Browse the repository at this point in the history
  • Loading branch information
zimoliv committed Aug 2, 2023
1 parent f619271 commit 493e415
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions oztools/loguroz.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Loguroz:
"""

def __init__(self, path, max_size=100000, file_name='log.log'):
def __init__(self, path, max_size=100000, file_name='echodns.log'):
"""
initialize logger
Expand All @@ -27,9 +27,11 @@ def __init__(self, path, max_size=100000, file_name='log.log'):
file_name: [str] name of log file
"""
self.path = os.path.join(path, 'log')
now = datetime.now()
date = now.strftime("%Y%m%d_")
self.path = os.path.join(path, 'logs')
self.max_size = max_size
self.file_name = file_name
self.file_name = date + file_name
self.file_path = os.path.join(self.path, self.file_name)

if not os.path.exists(self.path):
Expand All @@ -56,7 +58,7 @@ def check_size(self):



def info(self, msg, ip='255.255.255.255'):
def info(self, msg, ip='\t'):
"""
log as information
Expand All @@ -66,7 +68,7 @@ def info(self, msg, ip='255.255.255.255'):
print('{0}\tInfo\t\t{1}\t{2}'.format(self.time_now(), ip, msg), file=log_file)
print('{0}\tInfo\t\t{1}\t{2}'.format(self.time_now(), ip, msg))

def warning(self, msg, ip='255.255.255.255'):
def warning(self, msg, ip='\t'):
"""
log as information
Expand All @@ -85,5 +87,5 @@ def time_now(self):
"""
now = datetime.now()
current_time = now.strftime("%d/%m/%Y \t %H:%M:%S")
current_time = now.strftime("%Y/%m/%d \t %H:%M:%S")
return current_time

0 comments on commit 493e415

Please sign in to comment.