Subject: Re: [SWIPL] Newbie question

From: Jan Wielemaker <[email-masked]>
Date: Wed, 28 Feb 2001 12:20:24 +0100

On Wed, 28 Feb 2001, João Mariz wrote:
>Hi Swi-PROLOG users,
>
>Is there a way of sending those warnnings that may appear when we
>download a file with consult/1 predicate, to a file on the hard-disk?
>Perhaps someone could use open/3 and write/2 and build a new predicate
>to do it, however my problem is how do I redirect the warnning streams
>to the file openned?
>
>Thanks in advance for any help you can provide,

Depends a bit what you want.  If you simply want to store the session
for later reference, use protocol/1.  If you want to redirect the
error stream in general, you can do:

	open(myfile, write, Stream),
	set_stream(Stream, alias(user_error)),
	...

The multi-treading version uses this when connecting a console window
to a thread.

Finally, if you want to redirect the messages to an editor, the best
way is to define message_hook/3.  This is done for PceEmacs in 
...pl/xpce/prolog/lib/emacs/swi_prolog.pl

	--- Jan