Beispiel #1
0
 def _run_locked_subprocess(self, lockfile, sleeptime):
     code = ("import time\n"
             "from check_log_ng import LogChecker\n"
             "lockfile = '{0}'\n"
             "lockfileobj = LogChecker.lock(lockfile)\n"
             "time.sleep({1})\n"
             "LogChecker.unlock(lockfile, lockfileobj)\n").format(
                 lockfile, LogChecker.to_unicode(str(sleeptime)))
     code = code.replace("\n", ";")
     proc = subprocess.Popen(['python', '-c', code])
     return proc
Beispiel #2
0
 def _get_customized_timestamp(self):
     # format: Thu Dec 05 12:34:56 2013
     timestamp = LogChecker.to_unicode(
         datetime.datetime.now().strftime("%a %b %d %T %Y"))
     return timestamp
Beispiel #3
0
 def _get_timestamp(self):
     # format: Dec  5 12:34:00
     timestamp = LogChecker.to_unicode(
         datetime.datetime.now().strftime("%b %e %T"))
     return timestamp