Chris@10: /** Chris@10: * Some logging facilities Chris@10: * Copyright Yves Raimond (c) 2006 Chris@10: */ Chris@10: :- module(log,[log/1,log/2]). Chris@10: Chris@10: Chris@10: log_file('server.log'). Chris@10: Chris@10: log(MessageFormat,Vars) :- Chris@10: sformat(String,MessageFormat,Vars), Chris@10: log(String). Chris@10: Chris@10: log(Message) :- Chris@10: get_time(A), Chris@10: convert_time(A,Y,M,D,H,Min,S,_), Chris@10: sformat(Stamp,'<~d/~d/~d-~d:~d:~d> ',[Y,M,D,H,Min,S]), Chris@10: log_file(File), Chris@10: open(File,append,Stream,[]), Chris@10: write(Stream,Stamp), Chris@10: write(Stream,Message), Chris@10: write(Stream,'\n'), Chris@10: close(Stream). Chris@10: Chris@10: