File: grs_profile.py

package info (click to toggle)
doris 5.0.3~beta%2Bdfsg-16
  • links: PTS, VCS
  • area: contrib
  • in suites: bookworm
  • size: 6,932 kB
  • sloc: cpp: 43,560; python: 8,213; csh: 3,636; sh: 2,527; ansic: 649; makefile: 346; xml: 208
file content (17 lines) | stat: -rw-r--r-- 635 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import sys
import time

class GRS_Profile():

    def __init__(self, logfile, verbose):
        self.verbose = verbose
        if(verbose):
            self.start_time = time.localtime()
            self.logfile = logfile + "." + time.strftime("%a, %d %b %Y %H:%M:%S +0000",self.start_time).replace(" ", "_").replace(",", "").replace("+", "")

    def log_time_stamp(self, logtxt):
        if(self.verbose):
            fileHandle = open(self.logfile, 'a')
            message = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.localtime()) + ' : ' + logtxt + '\n'
            fileHandle.write(message)
            fileHandle.close()