Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Remove Output Messages?  (Read 26019 times)

0 Members and 1 Guest are viewing this topic.

zac

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Remove Output Messages?
« on: January 16, 2009, 06:20:27 pm »
I'm quite annoyed by SFMLs messages on failed Connections or on failure to close sockets.
I don't think it is the work of a portable library to warn the user about such things, for he should not be interested in them - and especially for the network, there are many reasons for a Socket failing to close or to accept an incoming connection, not always assoziated with the work of the programmer. Furthermore, the warnings can not be internationalized - there are a lot of reasons for not using the console output (especially for the network classes, warnings on missing images for example are okay). You might deactivate them for example when NDEBUG is defined.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Remove Output Messages?
« Reply #1 on: January 16, 2009, 11:01:27 pm »
I don't send messages to the console, only to std::cerr. Just redirect it to nothing or to a log file, if you want to keep your console clean ;)
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Remove Output Messages?
« Reply #2 on: January 17, 2009, 01:00:43 pm »
I also think SFML shouldn't generate any error messages except in debug mode. When errors occure, the underlying application must catch them and can then display a message if wanted. Else a library should be kept silent IMHO. Redirecting std::cerr works, of course. But that means that things that *I* print out to std::cerr in my application get redirected, too.

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
Remove Output Messages?
« Reply #3 on: January 17, 2009, 01:46:26 pm »
Quote from: "Laurent"
I don't send messages to the console, only to std::cerr. Just redirect it to nothing or to a log file, if you want to keep your console clean ;)


How do you redirect it to a file?

zac

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Remove Output Messages?
« Reply #4 on: January 17, 2009, 01:59:46 pm »
Not with any C++-Standard-Functions or something like that, AFAIK. I think you could either redirect C "stderr" via freopen() or you could redirect the underlying (system dependent) objects.
But for logging, you normally use clog instead of cerr.
My problem is, that MY cerr output will be redirected, too.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Remove Output Messages?
« Reply #5 on: January 17, 2009, 03:21:56 pm »
Quote
Not with any C++-Standard-Functions

You're wrong:
Code: [Select]
std::ofstream file("sfml-errors.txt");
std::cerr.rdbuf(file.rdbuf());


I'll think more about disabling error messages in release builds, thank you for your feedback.
Laurent Gomila - SFML developer

zac

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Remove Output Messages?
« Reply #6 on: January 17, 2009, 04:28:36 pm »
Ah. Good to know this. Never saw it before...

 

anything