Expose CDebugStream in modpython #461

Open
opened 2026-10-05 04:22:56 +02:00 by adam · 0 comments
Owner

It seems that the CDebugStream class does not expose the underlying std::ostringstream, how would a Python module go about logging with a result similar to the native DEBUG macro?

For example:

        a = znc.CDebugStream()
        del a

Successfully outputs an empty message to the debug output:

[2015-01-29 16:08:44.597957]

Yet, there's no way to set the str field, right?

Or perhaps should znc.Module have a debug method that outputs the timestamp and whatever string is passed to it.

def debug( self, message ):
        if znc.CDebug.Debug():
        print( '[%s] (%s) %s' % ( datetime.now(), self.__class__.__name__, message ) )

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

It seems that the `CDebugStream` class does not expose the underlying `std::ostringstream`, how would a Python module go about logging with a result similar to the native `DEBUG` macro? For example: ``` python a = znc.CDebugStream() del a ``` Successfully outputs an empty message to the debug output: [2015-01-29 16:08:44.597957] Yet, there's no way to set the `str` field, right? Or perhaps should `znc.Module` have a `debug` method that outputs the timestamp and whatever string is passed to it. ``` python def debug( self, message ): if znc.CDebug.Debug(): print( '[%s] (%s) %s' % ( datetime.now(), self.__class__.__name__, message ) ) ``` ## <bountysource-plugin> Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/8124852-expose-cdebugstream-in-modpython?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github). </bountysource-plugin> <!-- github-sync-id:55885977 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#461