annotate peel/urispace/log.pl @ 27:d95e683fbd35 tip

Enable CORS on urispace redirects as well
author Chris Cannam
date Tue, 20 Feb 2018 14:52:02 +0000
parents 6c62142a8b93
children
rev   line source
Chris@7 1 /**
Chris@7 2 * Some logging facilities
Chris@7 3 * Copyright Yves Raimond (c) 2006
Chris@7 4 */
Chris@7 5 :- module(log,[log/1,log/2]).
Chris@7 6
Chris@7 7
Chris@8 8 log_file('peel-uri.log').
Chris@7 9
Chris@7 10 log(MessageFormat,Vars) :-
Chris@7 11 sformat(String,MessageFormat,Vars),
Chris@7 12 log(String).
Chris@7 13
Chris@7 14 log(Message) :-
Chris@7 15 get_time(A),
Chris@7 16 convert_time(A,Y,M,D,H,Min,S,_),
Chris@7 17 sformat(Stamp,'<~d/~d/~d-~d:~d:~d> ',[Y,M,D,H,Min,S]),
Chris@7 18 log_file(File),
Chris@7 19 open(File,append,Stream,[]),
Chris@7 20 write(Stream,Stamp),
Chris@7 21 write(Stream,Message),
Chris@7 22 write(Stream,'\n'),
Chris@7 23 close(Stream).
Chris@7 24
Chris@7 25