log(X, Format, Args) :-
(loglevel(X)
-> log_stream(X,Stream,Colour),
format(Stream,'~w ~w~`.t~20|',[plspec, X]),
format_with_colour(Stream,Colour,Format,Args), nl(Stream)
; possible_loglevel(X) -> true
; format(user_error,'plspec internal error: ~w is not a valid loglevel!', [X])
).