module GLib
Constants
- GLIB_TO_SEVERITY
map glib levels to Logger::Severity
- G_FREE
save the FFI::Function that attach will return … we can use it directly as a param for callbacks
- LOG_FLAG_FATAL
- LOG_FLAG_RECURSION
log flags
- LOG_HANDLER
module-level, so it’s not GCd away
- LOG_LEVEL_CRITICAL
- LOG_LEVEL_DEBUG
- LOG_LEVEL_ERROR
GLib
log levels- LOG_LEVEL_INFO
- LOG_LEVEL_MESSAGE
- LOG_LEVEL_WARNING
Attributes
logger[RW]
Public Class Methods
remove_log_handler()
click to toggle source
# File lib/vips.rb, line 90 def self.remove_log_handler if @glib_log_handler_id != 0 && @glib_log_domain g_log_remove_handler @glib_log_domain, @glib_log_handler_id @glib_log_handler_id = nil end end
set_log_domain(domain)
click to toggle source
# File lib/vips.rb, line 97 def self.set_log_domain domain GLib::remove_log_handler @glib_log_domain = domain # forward all glib logging output from this domain to a Ruby logger if @glib_log_domain # disable this feature for now # # libvips background worker threads can issue warnings, and # since the main thread is blocked waiting for libvips to come back # from an ffi call, you get a deadlock on the GIL # # to fix this, we need a way for g_log() calls from libvips workers # to be returned via the main thread # # @glib_log_handler_id = g_log_set_handler @glib_log_domain, # LOG_LEVEL_DEBUG | # LOG_LEVEL_INFO | # LOG_LEVEL_MESSAGE | # LOG_LEVEL_WARNING | # LOG_LEVEL_ERROR | # LOG_LEVEL_CRITICAL | # LOG_FLAG_FATAL | LOG_FLAG_RECURSION, # LOG_HANDLER, nil # we must remove any handlers on exit, since libvips may log stuff # on shutdown and we don't want LOG_HANDLER to be invoked # after Ruby has gone at_exit { GLib::remove_log_handler } end end