X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=source%2FBootManager.py;h=df15c37abfcfc4062b5e31904dd1edf89257b8ba;hb=dd9ac9e9e7edc861a7176e6bed6d23c3a726d0b4;hp=5270c6ccc555d35ee1d8b3e64a5fbcec52f38403;hpb=18412e56c3b4b29f3383ed853a77fbdd9db1935f;p=bootmanager.git diff --git a/source/BootManager.py b/source/BootManager.py index 5270c6c..df15c37 100755 --- a/source/BootManager.py +++ b/source/BootManager.py @@ -71,13 +71,13 @@ class log: format="%H:%M:%S(%Z) " - def __init__( self, OutputFilePath= None ): + def __init__(self, OutputFilePath=None): try: - self.OutputFile= open( OutputFilePath, "w") - self.OutputFilePath= OutputFilePath + self.OutputFile = open( OutputFilePath, "w") + self.OutputFilePath = OutputFilePath except: print( "bootmanager log : Unable to open output file %r, continuing"%OutputFilePath ) - self.OutputFile= None + self.OutputFile = None self.VARS = None try: @@ -87,34 +87,34 @@ class log: self.LogEntry( str(e) ) return - def LogEntry( self, str, inc_newline= 1, display_screen= 1 ): - now=time.strftime(log.format, time.localtime()) + def LogEntry(self, str, inc_newline = 1, display_screen = 1 ): + now = time.strftime(log.format, time.localtime()) if self.OutputFile: - self.OutputFile.write( now+str ) + self.OutputFile.write(now + str) if display_screen: - sys.stdout.write( now+str ) + sys.stdout.write(now + str) if inc_newline: if display_screen: - sys.stdout.write( "\n" ) + sys.stdout.write("\n") if self.OutputFile: - self.OutputFile.write( "\n" ) + self.OutputFile.write("\n") if self.OutputFile: self.OutputFile.flush() - def write( self, str ): + def write(self, str): """ make log behave like a writable file object (for traceback prints) """ - self.LogEntry( str, 0, 1 ) + self.LogEntry(str, 0, 1) - def print_stack (self): + def print_stack(self): """ dump current stack in log """ - self.write ( traceback.format_exc() ) + self.write(traceback.format_exc()) # bm log uploading is available back again, as of nodeconfig-5.0-2 def Upload( self, extra_file=None ):