Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
N1ghtF1re committed Aug 11, 2018
1 parent aa6058d commit e0eb758
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 169 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
vk_config.v2.json
config.py
command.txt

*.log
*.pyc
*.ban
PythonAntiCaptchaImages/
__pycache__/

error.log
__pycache__/
27 changes: 10 additions & 17 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,23 +528,16 @@ def main():
logs = log.Log(const.log_filename) # Создаем объект логов


try:
if __name__ == '__main__':
main()
except Exception as error_msg:
while True:
try:
f = open('error.log', 'a')
except IOError:
f = open('error.log', 'w')
print(str(time.localtime(time.time())), file=f, end=' ')
print(error_msg, file = f, end='\n')
logs.write('ERROR!!!!!!' + error_msg)
f.close()
saveListToFile(black_list, const.file_name)
logs.write("I'm finishing my work ...")
main() # Произошло исключение - пробуем вернуться к работе
else:
saveListToFile(black_list, const.file_name)
logs.write("I'm finishing my work ...")
if __name__ == '__main__':
main()
except Exception as error_msg:
logs.write('ERROR!!!!!!' + error_msg)
saveListToFile(black_list, const.file_name)
logs.write("I'm finishing my work ...")
else:
saveListToFile(black_list, const.file_name)
logs.write("I'm finishing my work ...")

print(black_list)
4 changes: 2 additions & 2 deletions units/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def __init__(self, filename):
self.logfile = open(filename, 'w')

def write(self, message):
currtime = str(datetime.datetime.now())
message = '> [{0}] {1}'.format(currtime, str(message))
currtime = str(datetime.datetime.now().strftime('%d.%m.%Y %H:%M:%S'))
message = '[{0}] {1}'.format(currtime, str(message))
print(message, end='\n', file=self.logfile)
self.logfile.flush()

Expand Down
147 changes: 0 additions & 147 deletions voteban.log

This file was deleted.

0 comments on commit e0eb758

Please sign in to comment.