diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-03 19:30:41 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-03 19:30:41 (GMT) |
commit | 96d10a665b90a0ca0419cc4e074aa55aac4a54e2 (patch) | |
tree | f0c1cd377b6f96b23ec893b3652b0813e8cb2cfd /devbot/config.py | |
parent | 6f323c4988558ed05f1425a736d4145bb154ad69 (diff) |
Use progressive logs numbering
Diffstat (limited to 'devbot/config.py')
-rw-r--r-- | devbot/config.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/devbot/config.py b/devbot/config.py index 284e9a8..9cce430 100644 --- a/devbot/config.py +++ b/devbot/config.py @@ -202,6 +202,21 @@ def _save_prefs(prefs): for pref in prefs.items(): f.write("%s\n" % "=".join(pref)) +def get_log_path(prefix): + logfile_path = None + number = 0 + + while logfile_path is None: + name = "%s-%d.log" % (prefix, number) + path = os.path.join(logs_dir, name) + + if not os.path.exists(path): + logfile_path = path + + number = number + 1 + + return logfile_path + def get_pref(name): prefs = _read_prefs() return prefs.get(name, None) |