Building in such a way as to suppress log messages?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Building in such a way as to suppress log messages?

James Thistlewood
Hi all,

I'm building fluidsynth for use with a vimlike guitar-tab editor [1] I'm working on, and I've managed to shoehorn the .so into some Python bindings with success.

I have one problem: fluid prints a warning message, 'fluidsynth: warning: SDL2 not initialized, SDL2 audio driver won't be usable' at every startup.

Please, how can I build fluid in such a way that all log messages (well, maybe all but 'panic'-level ones) are hidden?

Thank you,

James


---------------

github: @jthistle


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: Building in such a way as to suppress log messages?

James Thistlewood
Ah, maybe I should have spent some more time looking through the code:

/* People who want to reduce the size of the may do this by entirely
* removing the logging system. This will cause all log messages to
* be discarded at compile time, allowing to save about 80 KiB for
* the compiled binary.
*/
#if 1
#define FLUID_LOG (void)sizeof
#else
#define FLUID_LOG fluid_log
#endif

fluidsynth_priv.h, L261.

Sorry for adding noise to the mailing list :)


James

---------------

github: @jthistle

On Mon, 7 Sep 2020 at 23:14, James Thistlewood <[hidden email]> wrote:
Hi all,

I'm building fluidsynth for use with a vimlike guitar-tab editor [1] I'm working on, and I've managed to shoehorn the .so into some Python bindings with success.

I have one problem: fluid prints a warning message, 'fluidsynth: warning: SDL2 not initialized, SDL2 audio driver won't be usable' at every startup.

Please, how can I build fluid in such a way that all log messages (well, maybe all but 'panic'-level ones) are hidden?

Thank you,

James


---------------

github: @jthistle


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: Building in such a way as to suppress log messages?

fluid-dev mailing list
The question should have been: "What's wrong in my client code that
fluidsynth keeps complaining about?"

Answer: fluidsynth was built with sdl2 support, therefore you should
call SDL_Init(SDL_INIT_AUDIO) in your code. Otherwise, you cannot use
the sdl2 audio driver, although fluidsynth provides the support for
it.

If you still want to customize logging, like disabling certain log
levels, you should use our API appropriately, by calling
fluid_set_log_function() and set the function handler to NULL:
http://www.fluidsynth.org/api/log_8h.html#a73045ac6812fb708625d1ea25e4e5224

That "hack" you've found in the source code is exactly that: A hack,
whose only existing purpose is for experts who need to squeeze
fluidsynth on a 128KiB embedded ROM.

The purpose of these log messages is to point users to misusages in
their own code. And it's really frustrating when the first thought
that comes up is "How can I disable this and everything else??"

P.S.: Making changes to fluidsynth's source code and adding this
customized libfluidsynth.so build to your public repository while not
providing the source code changes, is, technically, an LGPL license
infringement. Pls, stop it!


Tom

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: Building in such a way as to suppress log messages?

James Thistlewood
Hi Tom,

thanks for your detailed and helpful response.

I know full well that log messages are there for a reason. My problem isn't just that I want to suppress log
messages to stdout - it's that I need to (in release builds, at least). My programme uses curses, so if
anything gets sent to stdout other than that which curses sends, it breaks the whole display.

I wasn't aware that a minor change (i.e. literally just one character) would be enough to constitute license
violation in practice (although yes, I suppose in principle it is). I do apologise; I normally try to be very
careful to respect license terms.

Anyway, I will now build with SDL support turned off and use fluid_set_log_function to suppress log messages.

Thanks again for your help (and for creating this remarkable piece of software).


James

---------------

github: @jthistle

On Tue, 8 Sep 2020 at 13:22, Tom M. <[hidden email]> wrote:
The question should have been: "What's wrong in my client code that
fluidsynth keeps complaining about?"

Answer: fluidsynth was built with sdl2 support, therefore you should
call SDL_Init(SDL_INIT_AUDIO) in your code. Otherwise, you cannot use
the sdl2 audio driver, although fluidsynth provides the support for
it.

If you still want to customize logging, like disabling certain log
levels, you should use our API appropriately, by calling
fluid_set_log_function() and set the function handler to NULL:
http://www.fluidsynth.org/api/log_8h.html#a73045ac6812fb708625d1ea25e4e5224

That "hack" you've found in the source code is exactly that: A hack,
whose only existing purpose is for experts who need to squeeze
fluidsynth on a 128KiB embedded ROM.

The purpose of these log messages is to point users to misusages in
their own code. And it's really frustrating when the first thought
that comes up is "How can I disable this and everything else??"

P.S.: Making changes to fluidsynth's source code and adding this
customized libfluidsynth.so build to your public repository while not
providing the source code changes, is, technically, an LGPL license
infringement. Pls, stop it!


Tom

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev