Supressing Informational Messages

Help requests on developing Logtalk applications

Moderator: Paulo Moura

Post Reply
pedrofmj
Posts: 20
Joined: Sun Jan 18, 2015 1:15 pm

Supressing Informational Messages

Post by pedrofmj » Sun Jan 18, 2015 3:01 pm

Hi there.

I'm using JPL inside Java , with Logtalk.

I would like to remove the informational % messages. Is it possible in the current version?

Please see screenshot attached.
The informational messages I'm talking about is the messages/lines preceded with %.

Please, anyone knows how to do that?

Screenshot:
tela.png
Screenshot of Java Program output
tela.png (74.5 KiB) Viewed 3965 times
Thanks in advance,

Pedro Ferreira.

Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Supressing Informational Messages

Post by Paulo Moura » Sun Jan 18, 2015 3:12 pm

For the Logtalk generated messages, see comments near the end at the "settings-sample.lgt" file at the root of the Logtalk distribution. See also the report/1 compiler flag at:

http://logtalk.org/manuals/userman/prog ... ming_flags

For SWI-Prolog generated messages, see this system documentation, in particular the command-line flags.
Paulo Moura
Logtalk developer

pedrofmj
Posts: 20
Joined: Sun Jan 18, 2015 1:15 pm

Re: Supressing Informational Messages

Post by pedrofmj » Sun Jan 18, 2015 3:41 pm

Dear Paulo,

Thanks for the quick answer.

From the quickstart document, I see we put a settings.lgt into the application folder.

In the case, I'm using Logtalk inside Java through JPL.

Is there how I configure global settings for all applications instead of configuring settings-sample for each application?

Thanks,

Pedro Ferreira

pedrofmj
Posts: 20
Joined: Sun Jan 18, 2015 1:15 pm

Re: Supressing Informational Messages

Post by pedrofmj » Sun Jan 18, 2015 4:21 pm

Dear Paulo,

Solved!

I created a settings file inside the java application.

Thank You,

Pedro Ferreira.

pedrofmj
Posts: 20
Joined: Sun Jan 18, 2015 1:15 pm

Re: Supressing Informational Messages

Post by pedrofmj » Sun Jan 18, 2015 4:26 pm

The messagses reduced considerably. Now I would like only to suppress the messages from consult. I still have these messages

Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Supressing Informational Messages

Post by Paulo Moura » Sun Jan 18, 2015 4:28 pm

You can also put a custom "settings.lgt" file in the Logtalk user folder (that folder pointed by the LOGTALKUSER environment variable). See also the Logtalk wiki at GitHub on embedding Logtalk:

https://github.com/LogtalkDotOrg/logtal ... ng-Logtalk

Of course, you can also customize the adapter file for the backend Prolog compiler that you will be using. E.g. by turning off the "report" flag. But be sure to understand the differences and consequences of the different choices.
Paulo Moura
Logtalk developer

Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Supressing Informational Messages

Post by Paulo Moura » Sun Jan 18, 2015 4:29 pm

pedrofmj wrote:The messagses reduced considerably. Now I would like only to suppress the messages from consult. I still have these messages
Which messages? The ones printed by the Prolog compiler itself?
Paulo Moura
Logtalk developer

pedrofmj
Posts: 20
Joined: Sun Jan 18, 2015 1:15 pm

Re: Supressing Informational Messages

Post by pedrofmj » Sun Jan 18, 2015 4:52 pm

The consult messages were supressed.
Now I would like to remove only some logtalk messages. Please see below:

The tons of verbose were reduced to:

[exec] Logtalk loaded!
[exec] % [ /home/pedrofmj/logtalk/examples/ack/ack.lgt loaded ] <<<------------ This I still would like to remove
[exec] % [ /home/pedrofmj/logtalk/examples/ack/loader.lgt loaded ] <<<------------ This I still would like to remove
[exec] % (0 warnings) <<<------------ This I still would like to remove
[exec] Solution 1: {V=11}
[exec] % tmp_logtalk_swi_1421599821404 compiled 0.15 sec, 4,874 clauses <<<------------ This I still would like to remove
[exec] % 158 inferences, 0.000 CPU in 0.000 seconds (99% CPU, 2912067 Lips) <<<------------ This I still would like to remove

Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Supressing Informational Messages

Post by Paulo Moura » Sun Jan 18, 2015 5:04 pm

Similar to what you have already done in the settings file. For example, if you add (in the "my_logtalk_startup_settings" category) the clause:

Code: Select all

logtalk::message_hook(_, comment(_), core, _).
you will suppress all the informational messages from the Logtalk compiler.

The last two messages, however, come from SWI-Prolog itself. Try e.g.using the load_files/2 predicate with a silent(true) option instead of consult/1.
Paulo Moura
Logtalk developer

pedrofmj
Posts: 20
Joined: Sun Jan 18, 2015 1:15 pm

Re: Supressing Informational Messages

Post by pedrofmj » Sun Jan 18, 2015 7:54 pm

Now it's better. There is only one final message. I couldn't find the consult for it, I think there isn't how to remove it without changing the core, or then there is an option for that, that is the global message for all computation done.

Here is the image below.

Screenshot:
tela2.png
Demo
tela2.png (60.64 KiB) Viewed 3954 times

Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Supressing Informational Messages

Post by Paulo Moura » Sun Jan 18, 2015 8:02 pm

That's output from the SWI-Prolog time/1 library predicate, which takes a goal as argument.
Paulo Moura
Logtalk developer

pedrofmj
Posts: 20
Joined: Sun Jan 18, 2015 1:15 pm

Re: Supressing Informational Messages

Post by pedrofmj » Sun Jan 18, 2015 8:33 pm

Perfect, Dr. Paulo.

The test script has this predicate.

So, that's very fine!

Screenshot:
tela3.png
Demo 3
tela3.png (58.14 KiB) Viewed 3953 times

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest