Class: Wx::LogChain
Overview
This simple class allows you to chain log sinks, that is to install a new sink but keep passing log messages to the old one instead of replacing it completely as Wx::Log.set_active_target does.
It is especially useful when you want to divert the logs somewhere (for example to a file or a log window) but also keep showing the error messages using the standard dialogs as LogGui does by default. Example of usage:
logChain = Wx::LogChain.new(Wx::LogStderr.new)
# all the log messages are sent to stderr and also processed as usually
...
Category: Logging
Direct Known Subclasses
Instance Method Summary collapse
-
#get_old_log ⇒ Wx::Log
(also: #old_log)
Returns the pointer to the previously active log target (which may be NULL).
-
#initialize(logger) ⇒ Wx::LogChain
constructor
Sets the specified logger (which may be NULL) as the default log target but the log messages are also passed to the previous log target if any.
-
#is_passing_messages ⇒ Boolean
(also: #passing_messages?)
Returns true if the messages are passed to the previously active log target (default) or false if #pass_messages had been called.
-
#pass_messages(passMessages) ⇒ void
By default, the log messages are passed to the previously active log target.
-
#release ⇒ void
Releases the redirection chain and restores the previous log instance as the active log target.
-
#set_log(logger) ⇒ void
(also: #log=)
Sets another log target to use (may be NULL).
Methods inherited from Log
add_trace_mask, clear_trace_masks, disable_timestamp, #do_log_record, #do_log_text, #do_log_text_at_level, dont_create_on_demand, enable_logging, #flush, flush_active, for_component, get_active_target, get_log_level, get_repetition_counting, get_timestamp, get_trace_masks, get_verbose, is_allowed_trace_mask, is_enabled, is_level_enabled, #log_record, remove_trace_mask, resume, set_active_target, set_component_level, set_log_level, set_repetition_counting, set_timestamp, set_verbose, suspend
Constructor Details
#initialize(logger) ⇒ Wx::LogChain
Sets the specified logger (which may be NULL) as the default log target but the log messages are also passed to the previous log target if any.
371 |
# File 'lib/wx/doc/gen/log.rb', line 371 def initialize(logger) end |
Instance Method Details
#get_old_log ⇒ Wx::Log Also known as: old_log
Returns the pointer to the previously active log target (which may be NULL).
375 |
# File 'lib/wx/doc/gen/log.rb', line 375 def get_old_log; end |
#is_passing_messages ⇒ Boolean Also known as: passing_messages?
Returns true if the messages are passed to the previously active log target (default) or false if #pass_messages had been called.
380 |
# File 'lib/wx/doc/gen/log.rb', line 380 def ; end |
#pass_messages(passMessages) ⇒ void
This method returns an undefined value.
By default, the log messages are passed to the previously active log target.
Calling this function with false parameter disables this behaviour (presumably temporarily, as you shouldn’t use Wx::LogChain at all otherwise) and it can be re-enabled by calling it again with passMessages set to true.
388 |
# File 'lib/wx/doc/gen/log.rb', line 388 def (passMessages) end |
#release ⇒ void
This method returns an undefined value.
Releases the redirection chain and restores the previous log instance as the active log target. Traditionally in C++ applications would rely on the destructor to do this but that is not a really predictable option in wxRuby since destruction only takes place after GC collection (which is not exactly predictable) so wxRuby adds this method to better control restoration time if needed.
41 |
# File 'lib/wx/doc/log.rb', line 41 def release; end |
#set_log(logger) ⇒ void Also known as: log=
This method returns an undefined value.
Sets another log target to use (may be NULL).
The log target specified in the log_chain(wxLog) constructor or in a previous call to this function is deleted. This doesn’t change the old log target value (the one the messages are forwarded to) which still remains the same as was active when Wx::LogChain object was created.
395 |
# File 'lib/wx/doc/gen/log.rb', line 395 def set_log(logger) end |