@@ -51,21 +51,12 @@ func go_log_callback_bridge(user_data unsafe.Pointer, message *C.char, message_l
5151//
5252// Parameters:
5353// - callback: Function that will receive log messages
54- // - options: Formatting options for log messages (timestamps, thread names, etc.)
5554//
5655// Returns an error if the logging connection cannot be created.
57- func NewLoggingConnection (callback LogCallback , options LoggingOptions ) (* LoggingConnection , error ) {
58- cOptions := C.btck_LoggingOptions {
59- log_timestamps : boolToInt (options .LogTimestamps ),
60- log_time_micros : boolToInt (options .LogTimeMicros ),
61- log_threadnames : boolToInt (options .LogThreadNames ),
62- log_sourcelocations : boolToInt (options .LogSourceLocations ),
63- always_print_category_levels : boolToInt (options .AlwaysPrintCategoryLevel ),
64- }
65-
56+ func NewLoggingConnection (callback LogCallback ) (* LoggingConnection , error ) {
6657 callbackHandle := cgo .NewHandle (callback )
6758 ptr := C .btck_logging_connection_create ((C .btck_LogCallback )(C .go_log_callback_bridge ),
68- unsafe .Pointer (callbackHandle ), C .btck_DestroyCallback (C .go_delete_handle ), cOptions )
59+ unsafe .Pointer (callbackHandle ), C .btck_DestroyCallback (C .go_delete_handle ))
6960 if ptr == nil {
7061 callbackHandle .Delete ()
7162 return nil , & InternalError {"Failed to create logging connection" }
@@ -74,6 +65,23 @@ func NewLoggingConnection(callback LogCallback, options LoggingOptions) (*Loggin
7465 return & LoggingConnection {uniqueHandle : h }, nil
7566}
7667
68+ // SetLoggingOptions configures the formatting options for the global internal logger.
69+ //
70+ // This changes global settings and affects all existing LoggingConnection instances.
71+ //
72+ // Parameters:
73+ // - options: Formatting options for log messages (timestamps, thread names, etc.)
74+ func SetLoggingOptions (options LoggingOptions ) {
75+ cOptions := C.btck_LoggingOptions {
76+ log_timestamps : boolToInt (options .LogTimestamps ),
77+ log_time_micros : boolToInt (options .LogTimeMicros ),
78+ log_threadnames : boolToInt (options .LogThreadNames ),
79+ log_sourcelocations : boolToInt (options .LogSourceLocations ),
80+ always_print_category_levels : boolToInt (options .AlwaysPrintCategoryLevel ),
81+ }
82+ C .btck_logging_set_options (cOptions )
83+ }
84+
7785// DisableLogging permanently disables the global internal logger.
7886//
7987// No log messages will be buffered internally after this is called, and the buffer
0 commit comments