view classical/urispace/log.pl @ 21:9e70cd92f14e

Add CMN; add logging outputs
author Chris Cannam
date Wed, 08 Nov 2017 11:56:02 +0000
parents 91b5145fff34
children
line wrap: on
line source
/**
 * Some logging facilities
 * Copyright Yves Raimond (c) 2006
 */
:- module(log,[log/1,log/2]).


log_file('classical-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).