view classical/urispace/log.pl @ 16:ab3e3ac0119f

Restore this (referenced but not actually used in practice?) assertion.
author Chris Cannam
date Tue, 07 Nov 2017 11:44:02 +0000
parents 91b5145fff34
children 9e70cd92f14e
line wrap: on
line source
/**
 * Some logging facilities
 * Copyright Yves Raimond (c) 2006
 */
:- module(log,[log/1,log/2]).


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