logfile.icl 498 Bytes
Newer Older
1 2
implementation module logfile

3
import StdFile, StdPathname, StdBool, StdString
4 5 6 7 8 9 10 11 12 13 14 15

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)

Diederik van Arkel's avatar
Diederik van Arkel committed
16
writeLogfile :: !String !*File -> *File
17
writeLogfile s file = fwrites (s+++."\n") file