view cmn/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 9e70cd92f14e
children
line wrap: on
line source
/**
 * Some logging facilities
 * Copyright Yves Raimond (c) 2006
 */
:- module(log,[log/1,log/2]).


log_file('cmn-uri.log').

log(MessageFormat,Vars) :-
	sformat(String,MessageFormat,Vars),
	log(String).

log(Message) :-
	get_time(A),
	convert_time(A,Y,M,D,H,Min,S,_),
	sformat(Stamp,'<~d/~d/~d-~d:~d:~d> ',[Y,M,D,H,Min,S]),
	log_file(File),
	open(File,append,Stream,[]),
	write(Stream,Stamp),
	write(Stream,Message),
	write(Stream,'\n'),
	close(Stream).