4 Written by Broytman, Dec 1997. Copyright (C) 1997 PhiloSoft Design.
12 def __init__(self, f, overwrite = 0, timeformat = "%a %d %b %Y %T"):
13 if type(f) == type(''): # If f is string - use it as file's name
18 self.outfile = open(f, mode)
20 self.outfile = f # else assume it is opened file (fileobject) or
21 # "compatible" object (must has write() method)
23 self.timeformat = timeformat
31 if type(self.f) == type(''): # If f was opened - close it
36 self.outfile.write("%s %s\n" % (strftime(self.timeformat, localtime(time())), str))
55 log = makelog("test.log")
60 if __name__ == "__main__":