예제 #1
0
def _get_targets(conf, args, recur):
    if len(args) == 0:
        if conf.getboolean("general", "src_recur") or recur:
            targets = common.recur_dir(conf.getlist("general", "src_path"))
        else:
            targets = common.rep_dir(conf.getlist("general", "src_path"))
    else:
        if recur:
            targets = common.recur_dir(args)
        else:
            targets = common.rep_dir(args)
    return targets
예제 #2
0
def _get_targets(conf, args, recur):
    if len(args) == 0:
        if conf.getboolean("general", "src_recur") or recur:
            targets = common.recur_dir(conf.getlist("general", "src_path"))
        else:
            targets = common.rep_dir(conf.getlist("general", "src_path"))
    else:
        if recur:
            targets = common.recur_dir(args)
        else:
            targets = common.rep_dir(args)
    return targets
예제 #3
0
def test_parse(conf):
    LP = LogParser(conf)
    ret = []
    if conf.getboolean("general", "src_recur"):
        l_fp = common.recur_dir(conf.getlist("general", "src_path"))
    else:
        l_fp = common.rep_dir(conf.getlist("general", "src_path"))
    for fp in l_fp:
        with open(fp, 'r') as f:
            for line in f:
                ret.append(LP.process_line(line.rstrip("\n")))
    return ret
예제 #4
0
def test_parse(conf):
    LP = LogParser(conf)
    ret = []
    if conf.getboolean("general", "src_recur"):
        l_fp = common.recur_dir(conf.getlist("general", "src_path"))
    else:
        l_fp = common.rep_dir(conf.getlist("general", "src_path"))
    for fp in l_fp:
        with open(fp, 'r') as f:
            for line in f:
                ret.append(LP.process_line(line.rstrip("\n")))
    return ret
예제 #5
0
     timer = common.Timer("log_db make", output = _logger)
     timer.start()
     process_files(conf, targets, True)
     timer.stop()
 elif mode == "make-init":
     targets = _get_targets(conf, args, options.recur)
     timer = common.Timer("log_db make-init", output = _logger)
     timer.start()
     process_init_data(conf, targets)
     timer.stop()
 elif mode == "add":
     if len(args) == 0:
         sys.exit("give me filenames of log data to add to DB")
     else:
         if options.recur:
             targets = common.recur_dir(args)
         else:
             targets = common.rep_dir(args)
     timer = common.Timer("log_db add", output = _logger)
     timer.start()
     process_files(conf, targets, False)
     timer.stop()
 elif mode == "update":
     if len(args) == 0:
         sys.exit("give me filenames of log data to add to DB")
     else:
         if options.recur:
             targets = common.recur_dir(args)
         else:
             targets = common.rep_dir(args)
     timer = common.Timer("log_db update", output = _logger)
예제 #6
0
     timer = common.Timer("log_db make", output = _logger)
     timer.start()
     process_files(conf, targets, True)
     timer.stop()
 elif mode == "make-init":
     targets = _get_targets(conf, args, options.recur)
     timer = common.Timer("log_db make-init", output = _logger)
     timer.start()
     process_init_data(conf, targets)
     timer.stop()
 elif mode == "add":
     if len(args) == 0:
         sys.exit("give me filenames of log data to add to DB")
     else:
         if options.recur:
             targets = common.recur_dir(args)
         else:
             targets = common.rep_dir(args)
     timer = common.Timer("log_db add", output = _logger)
     timer.start()
     process_files(conf, targets, False)
     timer.stop()
 elif mode == "update":
     if len(args) == 0:
         sys.exit("give me filenames of log data to add to DB")
     else:
         if options.recur:
             targets = common.recur_dir(args)
         else:
             targets = common.rep_dir(args)
     timer = common.Timer("log_db update", output = _logger)