From jan@swi.psy.uva.nl Wed Feb 28 12:24:10 2001
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f1SBOAZ04019;
	Wed, 28 Feb 2001 12:24:10 +0100 (MET)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id MAA31047;
	Wed, 28 Feb 2001 12:24:09 +0100
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: Joćo Mariz <joao.mariz@mail.ineti.pt>,
   Swi-PROLOG usergroup <prolog@swi.psy.uva.nl>
Subject: Re: [SWIPL] Newbie question
Date: Wed, 28 Feb 2001 12:20:24 +0100
X-Mailer: KMail [version 1.0.28]
Content-Type: text/plain
References: <3A9CDDAB.9664071E@mail.ineti.pt>
In-Reply-To: <3A9CDDAB.9664071E@mail.ineti.pt>
MIME-Version: 1.0
Message-Id: <01022812240904.26632@gollem>
Content-Transfer-Encoding: 8bit

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

