def	__init__(self, fPath = os.getcwd(), fName = "log.txt"):
			"""	I intend to add some customization features to this,
					e.g., allowing the log file's name and directory to be
					specified, but that will be later
			"""
			self.fpath	=	fPath		#	the class variable, file path
			self.fname	=	fName		#	the class variable, file name
			self.log_file	=	""	#	the class variable, log file
			if	not os.path.isdir(self.fpath):
				self.fpath	=	os.getcwd()
			if	not os.path.isdir(self.fpath):
				sys.stderr.write ("in LogFile initialization\n")
				sys.stderr.write ("  file path set to: <<" + self.fpath + ">>\n")
				sys.stderr.write ("  This appears to not be a valid directory.")
				sys.stderr.write ("  This is a serious internal error")
				fail ("Log file path must be valid")

			if	os.path.isfile(os.path.join(self.fpath, fName)):
				self.fname	=	fName
			else:
				self.fname	=	"log.txt"
			tfName	=	os.path.join(self.fpath, self.fname)
			if	os.path.isfile(tfName):
				size	=	os.path.getsize(tfName)
				if	 size > 65536:
					mode	=	'w+'
				else:
					mode	=	'a+'
			else:
				failIf (os.path.exists(tfName), "file <<" + tfName + ">> exists, "
						+	"but is not a file (possibly a directory?)")
				mode	=	'w+'
			self.log_file	=	open(tfName, mode)
			self.log_file.write(".-=-" * 20 + "\n\n")
			self.log_file.write("log start at: " + time.ctime()
										+ "\n\n")
	I intend to add some customization features to this,
					e.g., allowing the log file's name and directory to be
					specified, but that will be later
			
recipes/Python/102263_Logfilepy__Singletlog_file/recipe-102263.py