Skip to content

Commit

Permalink
logs
Browse files Browse the repository at this point in the history
save log files to logs dir, fixed log datetime
  • Loading branch information
maldevel committed Dec 31, 2015
1 parent 32f976c commit c62f469
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion geolocation/IpGeoLocation.py
Expand Up @@ -4,7 +4,7 @@
"""
IPGeoLocation - Retrieve IP Geolocation information
Powered by http://ip-api.com
Copyright (C) 2015 @maldevel
Copyright (C) 2015-2016 @maldevel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion geolocation/IpGeoLocationLib.py
Expand Up @@ -4,7 +4,7 @@
"""
IPGeoLocation - Retrieve IP Geolocation information
Powered by http://ip-api.com
Copyright (C) 2015 @maldevel
Copyright (C) 2015-2016 @maldevel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion geolocation/__init__.py
@@ -1,7 +1,7 @@
"""
IPGeoLocation - Retrieve IP Geolocation information
Powered by http://ip-api.com
Copyright (C) 2015 @maldevel
Copyright (C) 2015-2016 @maldevel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion ip2geolocation.py
Expand Up @@ -4,7 +4,7 @@
"""
IPGeoLocation - Retrieve IP Geolocation information
Powered by http://ip-api.com
Copyright (C) 2015 @maldevel
Copyright (C) 2015-2016 @maldevel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion libraries/__init__.py
@@ -1,7 +1,7 @@
"""
IPGeoLocation - Retrieve IP Geolocation information
Powered by http://ip-api.com
Copyright (C) 2015 @maldevel
Copyright (C) 2015-2016 @maldevel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 2 additions & 0 deletions logs/.gitignore
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 1 addition & 1 deletion utilities/FileExporter.py
Expand Up @@ -4,7 +4,7 @@
"""
IPGeoLocation - Retrieve IP Geolocation information
Powered by http://ip-api.com
Copyright (C) 2015 @maldevel
Copyright (C) 2015-2016 @maldevel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
12 changes: 7 additions & 5 deletions utilities/Logger.py
Expand Up @@ -4,7 +4,7 @@
"""
IPGeoLocation - Retrieve IP Geolocation information
Powered by http://ip-api.com
Copyright (C) 2015 @maldevel
Copyright (C) 2015-2016 @maldevel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -22,13 +22,15 @@

__author__ = 'maldevel'

from time import gmtime, strftime
from datetime import datetime
import os

class Logger:

@staticmethod
def WriteLog(messagetype, message):
filename = '{}.log'.format(strftime("%Y%m%d", gmtime()))
with open(filename, 'a') as logFile:
logFile.write('[{}] {} - {}\n'.format(messagetype, strftime("%Y-%m-%d %H:%M:%S", gmtime()), message))
filename = '{}.log'.format(datetime.strftime(datetime.now(), "%Y%m%d"))
path = os.path.join('.', 'logs', filename)
with open(path, 'a') as logFile:
logFile.write('[{}] {} - {}\n'.format(messagetype, datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S"), message))

2 changes: 1 addition & 1 deletion utilities/MyExceptions.py
Expand Up @@ -4,7 +4,7 @@
"""
IPGeoLocation - Retrieve IP Geolocation information
Powered by http://ip-api.com
Copyright (C) 2015 @maldevel
Copyright (C) 2015-2016 @maldevel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion utilities/__init__.py
@@ -1,7 +1,7 @@
"""
IPGeoLocation - Retrieve IP Geolocation information
Powered by http://ip-api.com
Copyright (C) 2015 @maldevel
Copyright (C) 2015-2016 @maldevel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down

0 comments on commit c62f469

Please sign in to comment.