annotate chord/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 7902f428bc60
children
rev   line source
Chris@10 1 /**
Chris@10 2 * Some logging facilities
Chris@10 3 * Copyright Yves Raimond (c) 2006
Chris@10 4 */
Chris@10 5 :- module(log,[log/1,log/2]).
Chris@10 6
Chris@10 7
Chris@10 8 log_file('server.log').
Chris@10 9
Chris@10 10 log(MessageFormat,Vars) :-
Chris@10 11 sformat(String,MessageFormat,Vars),
Chris@10 12 log(String).
Chris@10 13
Chris@10 14 log(Message) :-
Chris@10 15 get_time(A),
Chris@10 16 convert_time(A,Y,M,D,H,Min,S,_),
Chris@10 17 sformat(Stamp,'<~d/~d/~d-~d:~d:~d> ',[Y,M,D,H,Min,S]),
Chris@10 18 log_file(File),
Chris@10 19 open(File,append,Stream,[]),
Chris@10 20 write(Stream,Stamp),
Chris@10 21 write(Stream,Message),
Chris@10 22 write(Stream,'\n'),
Chris@10 23 close(Stream).
Chris@10 24
Chris@10 25