iwla

iwla Commit Details

Date:2022-06-23 21:10:56 (1 year 3 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:37a33f1291fa3a828f3dd9f8b1a33ebb5a0269ee
Parents: b1f1158589a8f2dbde96c440b1043077d00043e5
Message:Replace -c argument by config file. Now clean output is -C

Changes:
Miwla.py (5 diffs)

File differences

iwla.py
3434
3535
3636
37
3837
3938
4039
......
658657
659658
660659
661
662
663
660
661
662
663
664664
665665
666666
......
766766
767767
768768
769
770
771
772
769773
770
771
772
774
773775
774776
775777
......
842844
843845
844846
845
847
848
849
850
851
846852
847853
848854
......
875881
876882
877883
884
885
886
887
888
878889
879890
880891
from datetime import date, datetime
import default_conf as conf
import conf as user_conf
from iplugin import *
from display import *
if not year in self.meta_infos['stats'].keys():
self.meta_infos['stats'][year] = {}
self.meta_infos['stats'][year][month] = duplicated_stats
self.logger.info("==> Serialize to %s" % (conf.META_PATH))
self._serialize(self.meta_infos, conf.META_PATH)
meta_path = os.path.join(conf.DB_ROOT, conf.META_FILENAME)
self.logger.info("==> Serialize to %s" % (meta_path))
self._serialize(self.meta_infos, meta_path)
self._generateDisplay()
def start(self, _file, args):
self.args = args
self.start_time = datetime.now()
meta_path = os.path.join(conf.DB_ROOT, conf.META_FILENAME)
if os.path.exists(meta_path):
self.logger.info('==> Load previous database')
self.logger.info('==> Load previous database')
self.meta_infos = self._deserialize(conf.META_PATH) or self._clearMeta()
self.meta_infos = self._deserialize(meta_path) or self._clearMeta()
if self.meta_infos['last_time']:
if args.reset:
self._reset()
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Intelligent Web Log Analyzer')
parser.add_argument('-c', '--clean-output', dest='clean_output', action='store_true',
parser.add_argument('-c', '--config-file', dest='config_file',
default='conf.py', type=str,
help='Config file to use (default conf.py)')
parser.add_argument('-C', '--clean-output', dest='clean_output', action='store_true',
default=False,
help='Clean output before starting')
args = parser.parse_args()
if args.config_file.endswith('.py'):
args.config_file = args.config_file[:-3]
user_conf = importlib.import_module(args.config_file)
# Load user conf
for (k,v) in user_conf.__dict__.items():
if k.endswith('_append'):

Archive Download the corresponding diff file

Branches

Tags