logfile.icl 488 Bytes
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
implementation module logfile

import StdFile, StdPathname, StdBool

openLogfile :: !String !*f -> (!Bool,!*File,!*f)	| FileSystem f
openLogfile prj_name env
	# log_name = RemoveSuffix prj_name +++. ".log"
	= fopen log_name FWriteText env

closeLogfile :: !*File !*f -> (!Bool,!*f)	| FileSystem f
closeLogfile file env
	# (ok1,file)	= ferror file
	# (ok2,env)		= fclose file env
	= (ok1 && ok2,env)

writeLogfile :: !String !*File -> !*File
writeLogfile s file = fwrites (s+++."\n") file