1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxLog and related classes documentation
4 %% Author: Vadim Zeitlin
6 %% Created: some time ago
8 %% Copyright: (c) 1997-2001 Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxLog
}}\label{wxlog
}
14 wxLog class defines the interface for the
{\it log targets
} used by wxWidgets
15 logging functions as explained in the
\helpref{wxLog overview
}{wxlogoverview
}.
16 The only situations when you need to directly use this class is when you want
17 to derive your own log target because the existing ones don't satisfy your
18 needs. Another case is if you wish to customize the behaviour of the standard
19 logging classes (all of which respect the wxLog settings): for example, set
20 which trace messages are logged and which are not or change (or even remove
21 completely) the timestamp on the messages.
23 Otherwise, it is completely hidden behind the
{\it wxLogXXX()
} functions and
24 you may not even know about its existence.
26 See
\helpref{log overview
}{wxlogoverview
} for the descriptions of wxWidgets
29 \wxheading{Derived from
}
33 \wxheading{Include files
}
39 \helpref{wxCore
}{librarieslist
}
41 \latexignore{\rtfignore{\wxheading{Function groups
}}}
43 \membersection{Global functions
}
45 The functions in this section work with and manipulate the active log target.
46 The
\helpref{OnLog()
}{wxlogonlog
} is called by the
{\it wxLogXXX()
} functions
47 and invokes the
\helpref{DoLog()
}{wxlogdolog
} of the active log target if any.
48 Get/Set methods are used to install/query the current active target and,
49 finally,
\helpref{DontCreateOnDemand()
}{wxlogdontcreateondemand
} disables the
50 automatic creation of a standard log target if none actually exists. It is
51 only useful when the application is terminating and shouldn't be used in other
52 situations because it may easily lead to a loss of messages.
54 \helpref{OnLog
}{wxlogonlog
}\\
55 \helpref{GetActiveTarget
}{wxloggetactivetarget
}\\
56 \helpref{SetActiveTarget
}{wxlogsetactivetarget
}\\
57 \helpref{DontCreateOnDemand
}{wxlogdontcreateondemand
}\\
58 \helpref{Suspend
}{wxlogsuspend
}\\
59 \helpref{Resume
}{wxlogresume
}
61 \membersection{Logging functions
}\label{loggingfunctions
}
63 There are two functions which must be implemented by any derived class to
64 actually process the log messages:
\helpref{DoLog
}{wxlogdolog
} and
65 \helpref{DoLogString
}{wxlogdologstring
}. The second function receives a string
66 which just has to be output in some way and the easiest way to write a new log
67 target is to override just this function in the derived class. If more control
68 over the output format is needed, then the first function must be overridden
69 which allows to construct custom messages depending on the log level or even
70 do completely different things depending on the message severity (for example,
71 throw away all messages except warnings and errors, show warnings on the
72 screen and forward the error messages to the user's (or programmer's) cell
73 phone - maybe depending on whether the timestamp tells us if it is day or
74 night in the current time zone).
76 There also functions to support message buffering. Why are they needed?
77 Some of wxLog implementations, most notably the standard wxLogGui class,
78 buffer the messages (for example, to avoid showing the user a zillion of modal
79 message boxes one after another -- which would be really annoying).
80 \helpref{Flush()
}{wxlogflush
} shows them all and clears the buffer contents.
81 This function doesn't do anything if the buffer is already empty.
83 \helpref{Flush
}{wxlogflush
}\\
84 \helpref{FlushActive
}{wxlogflushactive
}
86 \membersection{Customization
}\label{wxlogcustomization
}
88 The functions below allow some limited customization of wxLog behaviour
89 without writing a new log target class (which, aside of being a matter of
90 several minutes, allows you to do anything you want).
92 The verbose messages are the trace messages which are not disabled in the
93 release mode and are generated by
\helpref{wxLogVerbose
}{wxlogverbose
}. They
94 are not normally shown to the user because they present little interest, but
95 may be activated, for example, in order to help the user find some program
98 As for the (real) trace messages, their handling depends on the settings of
99 the (application global)
{\it trace mask
}. There are two ways to specify it:
100 either by using
\helpref{SetTraceMask
}{wxlogsettracemask
} and
101 \helpref{GetTraceMask
}{wxloggettracemask
} and using
102 \helpref{wxLogTrace
}{wxlogtrace
} which takes an integer mask or by using
103 \helpref{AddTraceMask
}{wxlogaddtracemask
} for string trace masks.
105 The difference between bit-wise and string trace masks is that a message using
106 integer trace mask will only be logged if all bits of the mask are set in the
107 current mask while a message using string mask will be logged simply if the
108 mask had been added before to the list of allowed ones.
113 // wxTraceOleCalls is one of standard bit masks
114 wxLogTrace(wxTraceRefCount | wxTraceOleCalls, "Active object ref count:
%d", nRef);
116 will do something only if the current trace mask contains both
117 {\tt wxTraceRefCount
} and
{\tt wxTraceOle
}, but
120 // wxTRACE_OleCalls is one of standard string masks
121 wxLogTrace(wxTRACE_OleCalls, "IFoo::Bar() called");
124 will log the message if it was preceded by
127 wxLog::AddTraceMask(wxTRACE_OleCalls);
130 Using string masks is simpler and allows to easily add custom ones, so this is
131 the preferred way of working with trace messages. The integer trace mask is
132 kept for compatibility and for additional (but very rarely needed) flexibility
135 The standard trace masks are given in
\helpref{wxLogTrace
}{wxlogtrace
}
138 Finally, the
{\it wxLog::DoLog()
} function automatically prepends a time stamp
139 to all the messages. The format of the time stamp may be changed: it can be
140 any string with \% specifications fully described in the documentation of the
141 standard
{\it strftime()
} function. For example, the default format is
142 "
[\%d/\%b/\%y \%H:\%M:\%S
] " which gives something like "
[17/Sep/
98 22:
10:
16] "
143 (without quotes) for the current date. Setting an empty string as the time
144 format disables timestamping of the messages completely.
146 {\bf NB:
} Timestamping is disabled for Visual C++ users in debug builds by
147 default because otherwise it would be impossible to directly go to the line
148 from which the log message was generated by simply clicking in the debugger
149 window on the corresponding error message. If you wish to enable it, please use
150 \helpref{SetTimestamp
}{wxlogsettimestamp
} explicitly.
152 \helpref{AddTraceMask
}{wxlogaddtracemask
}\\
153 \helpref{RemoveTraceMask
}{wxlogremovetracemask
}\\
154 \helpref{ClearTraceMasks
}{wxlogcleartracemasks
}\\
155 \helpref{GetTraceMasks
}{wxloggettracemasks
}\\
156 \helpref{IsAllowedTraceMask
}{wxlogisallowedtracemask
}\\
157 \helpref{SetVerbose
}{wxlogsetverbose
}\\
158 \helpref{GetVerbose
}{wxloggetverbose
}\\
159 \helpref{SetTimestamp
}{wxlogsettimestamp
}\\
160 \helpref{GetTimestamp
}{wxloggettimestamp
}\\
161 \helpref{SetTraceMask
}{wxlogsettracemask
}\\
162 \helpref{GetTraceMask
}{wxloggettracemask
}\\
163 \helpref{SetRepetitionCounting
}{wxlogsetrepetitioncounting
}\\
164 \helpref{GetRepetitionCounting
}{wxloggetrepetitioncounting
}
166 %%%%% MEMBERS HERE %%%%%
167 \helponly{\insertatlevel{2}{
173 \membersection{wxLog::AddTraceMask
}\label{wxlogaddtracemask
}
175 \func{static void
}{AddTraceMask
}{\param{const wxString\&
}{mask
}}
177 Add the
{\it mask
} to the list of allowed masks for
178 \helpref{wxLogTrace
}{wxlogtrace
}.
182 \helpref{RemoveTraceMask
}{wxlogremovetracemask
}
183 \helpref{GetTraceMasks
}{wxloggettracemasks
}
185 \membersection{wxLog::ClearTraceMasks
}\label{wxlogcleartracemasks
}
187 \func{static void
}{ClearTraceMasks
}{\void}
189 Removes all trace masks previously set with
190 \helpref{AddTraceMask
}{wxlogaddtracemask
}.
194 \helpref{RemoveTraceMask
}{wxlogremovetracemask
}
196 \membersection{wxLog::GetTraceMasks
}\label{wxloggettracemasks
}
198 \func{static const wxArrayString \&
}{GetTraceMasks
}{\void}
200 Returns the currently allowed list of string trace masks.
204 \helpref{AddTraceMask
}{wxlogaddtracemask
}.
206 \membersection{wxLog::OnLog
}\label{wxlogonlog
}
208 \func{static void
}{OnLog
}{\param{wxLogLevel
}{ level
},
\param{const wxString\&
}{ message
}}
210 Forwards the message at specified level to the
{\it DoLog()
} function of the
211 active log target if there is any, does nothing otherwise.
213 \membersection{wxLog::GetActiveTarget
}\label{wxloggetactivetarget
}
215 \func{static wxLog *
}{GetActiveTarget
}{\void}
217 Returns the pointer to the active log target (may be NULL).
219 \membersection{wxLog::SetActiveTarget
}\label{wxlogsetactivetarget
}
221 \func{static wxLog *
}{SetActiveTarget
}{\param{wxLog *
}{ logtarget
}}
223 Sets the specified log target as the active one. Returns the pointer to the
224 previous active log target (may be NULL). To suppress logging use a new
225 instance of wxLogNull not NULL. If the active log target is set to NULL a
226 new default log target will be created when logging occurs.
228 \membersection{wxLog::Suspend
}\label{wxlogsuspend
}
230 \func{static void
}{Suspend
}{\void}
232 Suspends the logging until
\helpref{Resume
}{wxlogresume
} is called. Note that
233 the latter must be called the same number of times as the former to undo it,
234 i.e. if you call Suspend() twice you must call Resume() twice as well.
236 Note that suspending the logging means that the log sink won't be be flushed
237 periodically, it doesn't have any effect if the current log target does the
238 logging immediately without waiting for
\helpref{Flush
}{wxlogflush
} to be
239 called (the standard GUI log target only shows the log dialog when it is
240 flushed, so Suspend() works as expected with it).
244 \helpref{Resume
}{wxlogresume
},\\
245 \helpref{wxLogNull
}{wxlogoverview
}
247 \membersection{wxLog::Resume
}\label{wxlogresume
}
249 \func{static void
}{Resume
}{\void}
251 Resumes logging previously suspended by a call to
252 \helpref{Suspend
}{wxlogsuspend
}. All messages logged in the meanwhile will be
255 \membersection{wxLog::DoLog
}\label{wxlogdolog
}
257 \func{virtual void
}{DoLog
}{\param{wxLogLevel
}{level
},
\param{const wxString\&
}{msg
},
\param{time
\_t }{timestamp
}}
259 Called to process the message of the specified severity.
{\it msg
} is the text
260 of the message as specified in the call of
{\it wxLogXXX()
} function which
261 generated it and
{\it timestamp
} is the moment when the message was generated.
263 The base class version prepends the timestamp to the message, adds a prefix
264 corresponding to the log level and then calls
265 \helpref{DoLogString
}{wxlogdologstring
} with the resulting string.
267 \membersection{wxLog::DoLogString
}\label{wxlogdologstring
}
269 \func{virtual void
}{DoLogString
}{\param{const wxString\&
}{msg
},
\param{time
\_t }{timestamp
}}
271 Called to log the specified string. The timestamp is already included in the
272 string but still passed to this function.
274 A simple implementation may just send the string to
{\tt stdout
} or, better,
277 \membersection{wxLog::DontCreateOnDemand
}\label{wxlogdontcreateondemand
}
279 \func{static void
}{DontCreateOnDemand
}{\void}
281 Instructs wxLog to not create new log targets on the fly if there is none
282 currently. (Almost) for internal use only: it is supposed to be called by the
283 application shutdown code.
285 Note that this function also calls
286 \helpref{ClearTraceMasks
}{wxlogcleartracemasks
}.
288 \membersection{wxLog::Flush
}\label{wxlogflush
}
290 \func{virtual void
}{Flush
}{\void}
292 Shows all the messages currently in buffer and clears it. If the buffer
293 is already empty, nothing happens.
295 \membersection{wxLog::FlushActive
}\label{wxlogflushactive
}
297 \func{static void
}{FlushActive
}{\void}
299 Flushes the current log target if any, does nothing if there is none.
303 \helpref{Flush
}{wxlogflush
}
305 \membersection{wxLog::SetVerbose
}\label{wxlogsetverbose
}
307 \func{static void
}{SetVerbose
}{\param{bool
}{ verbose = true
}}
309 Activates or deactivates verbose mode in which the verbose messages are
310 logged as the normal ones instead of being silently dropped.
312 \membersection{wxLog::GetVerbose
}\label{wxloggetverbose
}
314 \func{static bool
}{GetVerbose
}{\void}
316 Returns whether the verbose mode is currently active.
318 \membersection{wxLog::SetLogLevel
}\label{wxlogsetloglevel
}
320 \func{static void
}{SetLogLevel
}{\param{wxLogLevel
}{ logLevel
}}
322 Specifies that log messages with $level > logLevel$ should be ignored
323 and not sent to the active log target.
325 \membersection{wxLog::GetLogLevel
}\label{wxloggetloglevel
}
327 \func{static wxLogLevel
}{GetLogLevel
}{\void}
329 Returns the current log level limit.
331 \membersection{wxLog::SetRepetitionCounting
}\label{wxlogsetrepetitioncounting
}
333 \func{static void
}{SetRepetitionCounting
}{\param{bool
}{ repetCounting = true
}}
335 Enables logging mode in which a log message is logged once, and in case exactly
336 the same message successively repeats one or more times, only the number of
337 repetitions is logged.
339 \membersection{wxLog::GetRepetitionCounting
}\label{wxloggetrepetitioncounting
}
341 \func{static bool
}{GetRepetitionCounting
}{\void}
343 Returns whether the repetition counting mode is enabled.
346 \membersection{wxLog::SetTimestamp
}\label{wxlogsettimestamp
}
348 \func{static void
}{SetTimestamp
}{\param{const wxString\&
}{ format
}}
350 Sets the timestamp format prepended by the default log targets to all
351 messages. The string may contain any normal characters as well as \%
352 prefixed format specificators, see
{\it strftime()
} manual for details.
353 Passing an empty string to this function disables message time stamping.
355 \membersection{wxLog::DisableTimestamp
}\label{wxlogdisabletimestamp
}
357 \func{void
}{SetTimestamp
}{\param{const wxString\&
}{ format
}}
359 Disables time stamping of the log messages.
363 \membersection{wxLog::GetTimestamp
}\label{wxloggettimestamp
}
365 \func{static const wxString\&
}{GetTimestamp
}{\void}
367 Returns the current timestamp format string.
369 \membersection{wxLog::SetTraceMask
}\label{wxlogsettracemask
}
371 \func{static void
}{SetTraceMask
}{\param{wxTraceMask
}{ mask
}}
373 Sets the trace mask, see
\helpref{Customization
}{wxlogcustomization
}
376 \membersection{wxLog::GetTraceMask
}\label{wxloggettracemask
}
378 \func{static wxTraceMask
}{GetTraceMask
}{\void}
380 Returns the current trace mask, see
\helpref{Customization
}{wxlogcustomization
} section
383 \membersection{wxLog::IsAllowedTraceMask
}\label{wxlogisallowedtracemask
}
385 \func{static bool
}{IsAllowedTraceMask
}{\param{const wxString\&
}{mask
}}
387 Returns true if the
{\it mask
} is one of allowed masks for
388 \helpref{wxLogTrace
}{wxlogtrace
}.
390 See also:
\helpref{AddTraceMask
}{wxlogaddtracemask
},
391 \helpref{RemoveTraceMask
}{wxlogremovetracemask
}
393 \membersection{wxLog::RemoveTraceMask
}\label{wxlogremovetracemask
}
395 \func{static void
}{RemoveTraceMask
}{\param{const wxString\&
}{mask
}}
397 Remove the
{\it mask
} from the list of allowed masks for
398 \helpref{wxLogTrace
}{wxlogtrace
}.
400 See also:
\helpref{AddTraceMask
}{wxlogaddtracemask
}
402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogChain %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
404 \section{\class{wxLogChain
}}\label{wxlogchain
}
406 This simple class allows to chain log sinks, that is to install a new sink but
407 keep passing log messages to the old one instead of replacing it completely as
408 \helpref{SetActiveTarget
}{wxlogsetactivetarget
} does.
410 It is especially useful when you want to divert the logs somewhere (for
411 example to a file or a log window) but also keep showing the error messages
412 using the standard dialogs as
\helpref{wxLogGui
}{wxlogoverview
} does by default.
417 wxLogChain *logChain = new wxLogChain(new wxLogStderr);
419 // all the log messages are sent to stderr and also processed as usually
422 // don't delete logChain directly as this would leave a dangling
423 // pointer as active log target, use SetActiveTarget() instead
424 delete wxLog::SetActiveTarget(...something else or NULL...);
428 \wxheading{Derived from
}
430 \helpref{wxLog
}{wxlog
}
432 \wxheading{Include files
}
438 \helpref{wxBase
}{librarieslist
}
440 \latexignore{\rtfignore{\wxheading{Members
}}}
442 \membersection{wxLogChain::wxLogChain
}\label{wxlogchainctor
}
444 \func{}{wxLogChain
}{\param{wxLog *
}{logger
}}
446 Sets the specified
{\tt logger
} (which may be
{\tt NULL
}) as the default log
447 target but the log messages are also passed to the previous log target if any.
449 \membersection{wxLogChain::
\destruct{wxLogChain
}}\label{wxlogchaindtor
}
451 \func{}{\destruct{wxLogChain
}}{\void}
453 Destroys the previous log target.
455 \membersection{wxLogChain::DetachOldLog
}\label{wxlogchaindetacholdlog
}
457 \func{void
}{DetachOldLog
}{\void}
459 Detaches the old log target so it won't be destroyed when the wxLogChain object
462 \membersection{wxLogChain::GetOldLog
}\label{wxlogchaingetoldlog
}
464 \constfunc{wxLog *
}{GetOldLog
}{\void}
466 Returns the pointer to the previously active log target (which may be
{\tt
469 \membersection{wxLogChain::IsPassingMessages
}\label{wxlogchainispassingmessages
}
471 \constfunc{bool
}{IsPassingMessages
}{\void}
473 Returns
{\tt true
} if the messages are passed to the previously active log
474 target (default) or
{\tt false
} if
\helpref{PassMessages
}{wxlogchainpassmessages
}
477 \membersection{wxLogChain::PassMessages
}\label{wxlogchainpassmessages
}
479 \func{void
}{PassMessages
}{\param{bool
}{passMessages
}}
481 By default, the log messages are passed to the previously active log target.
482 Calling this function with
{\tt false
} parameter disables this behaviour
483 (presumably temporarily, as you shouldn't use wxLogChain at all otherwise) and
484 it can be reenabled by calling it again with
{\it passMessages
} set to
{\tt
487 \membersection{wxLogChain::SetLog
}\label{wxlogchainsetlog
}
489 \func{void
}{SetLog
}{\param{wxLog *
}{logger
}}
491 Sets another log target to use (may be
{\tt NULL
}). The log target specified
492 in the
\helpref{constructor
}{wxlogchainctor
} or in a previous call to
493 this function is deleted.
495 This doesn't change the old log target value (the one the messages are
496 forwarded to) which still remains the same as was active when wxLogChain
499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogGui %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
501 \section{\class{wxLogGui
}}\label{wxloggui
}
503 This is the default log target for the GUI wxWidgets applications. It is passed
504 to
\helpref{wxLog::SetActiveTarget
}{wxlogsetactivetarget
} at the program
505 startup and is deleted by wxWidgets during the program shut down.
507 \wxheading{Derived from
}
509 \helpref{wxLog
}{wxlog
}
511 \wxheading{Include files
}
515 \latexignore{\rtfignore{\wxheading{Members
}}}
517 \membersection{wxLogGui::wxLogGui
}\label{wxlogguictor
}
519 \func{}{wxLogGui
}{\void}
523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogNull %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
525 \section{\class{wxLogNull
}}\label{wxlognull
}
527 This class allows to temporarily suspend logging. All calls to the log
528 functions during the life time of an object of this class are just ignored.
530 In particular, it can be used to suppress the log messages given by wxWidgets
531 itself but it should be noted that it is rarely the best way to cope with this
532 problem as
{\bf all
} log messages are suppressed, even if they indicate a
533 completely different error than the one the programmer wanted to suppress.
535 For instance, the example of the overview:
541 // wxFile.Open() normally complains if file can't be opened, we don't want it
544 if ( !file.Open("bar") )
545 ... process error ourselves ...
546 } // ~wxLogNull called, old log sink restored
548 wxLogMessage("..."); // ok
552 would be better written as:
558 // don't try to open file if it doesn't exist, we are prepared to deal with
559 // this ourselves - but all other errors are not expected
560 if ( wxFile::Exists("bar") )
562 // gives an error message if the file couldn't be opened
572 \wxheading{Derived from
}
574 \helpref{wxLog
}{wxlog
}
576 \wxheading{Include files
}
582 \helpref{wxBase
}{librarieslist
}
584 \latexignore{\rtfignore{\wxheading{Members
}}}
586 \membersection{wxLogNull::wxLogNull
}\label{wxlognullctor
}
588 \func{}{wxLogNull
}{\void}
592 \membersection{wxLogNull::
\destruct{wxLogNull
}}\label{wxlognulldtor
}
596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogInterposer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
598 \section{\class{wxLogInterposer
}}\label{wxloginterposer
}
600 A special version of
\helpref{wxLogChain
}{wxlogchain
} which uses itself as the
601 new log target. It forwards log messages to the previously installed one in addition to
602 processing them itself.
604 Unlike
\helpref{wxLogChain
}{wxlogchain
} which is usually used directly as is,
605 this class must be derived from to implement
\helpref{DoLog
}{wxlogdolog
}
606 and/or
\helpref{DoLogString
}{wxlogdologstring
} methods.
608 wxLogInterposer destroys the previous log target in its destructor. If you
609 don't want this to happen, use wxLogInterposerTemp instead.
611 \wxheading{Derived from
}
613 \helpref{wxLogChain
}{wxlogchain
}\\
614 \helpref{wxLog
}{wxlog
}
616 \wxheading{Include files
}
622 \helpref{wxBase
}{librarieslist
}
624 \latexignore{\rtfignore{\wxheading{Members
}}}
626 \membersection{wxLogInterposer::wxLogInterposer
}\label{wxloginterposerctor
}
628 The default constructor installs this object as the current active log target.
630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogInterposerTemp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
632 \section{\class{wxLogInterposerTemp
}}\label{wxloginterposertemp
}
634 A special version of
\helpref{wxLogChain
}{wxlogchain
} which uses itself as the
635 new log target. It forwards log messages to the previously installed one in addition to
636 processing them itself. Unlike
\helpref{wxLogInterposer
}{wxloginterposer
}, it doesn't
637 delete the old target which means it can be used to temporarily redirect log output.
639 As per wxLogInterposer, this class must be derived from to implement
\helpref{DoLog
}{wxlogdolog
}
640 and/or
\helpref{DoLogString
}{wxlogdologstring
} methods.
642 \wxheading{Derived from
}
644 \helpref{wxLogChain
}{wxlogchain
}\\
645 \helpref{wxLog
}{wxlog
}
647 \wxheading{Include files
}
653 \helpref{wxBase
}{librarieslist
}
655 \latexignore{\rtfignore{\wxheading{Members
}}}
657 \membersection{wxLogInterposerTemp::wxLogInterposerTemp
}\label{wxloginterposertempctor
}
659 The default constructor installs this object as the current active log target.
661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogStderr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
663 \section{\class{wxLogStderr
}}\label{wxlogstderr
}
665 This class can be used to redirect the log messages to a C file stream (not to
666 be confused with C++ streams). It is the default log target for the non-GUI
667 wxWidgets applications which send all the output to
{\tt stderr
}.
669 \wxheading{Derived from
}
671 \helpref{wxLog
}{wxlog
}
673 \wxheading{Include files
}
679 \helpref{wxBase
}{librarieslist
}
683 \helpref{wxLogStream
}{wxlogstream
}
685 \latexignore{\rtfignore{\wxheading{Members
}}}
687 \membersection{wxLogStderr::wxLogStderr
}\label{wxlogstderrctor
}
689 \func{}{wxLogStderr
}{\param{FILE
}{*fp = NULL
}}
691 Constructs a log target which sends all the log messages to the given
692 {\tt FILE
}. If it is
{\tt NULL
}, the messages are sent to
{\tt stderr
}.
694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogStream %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
696 \section{\class{wxLogStream
}}\label{wxlogstream
}
698 This class can be used to redirect the log messages to a C++ stream.
700 Please note that this class is only available if wxWidgets was compiled with
701 the standard iostream library support (
{\tt wxUSE
\_STD\_IOSTREAM} must be on).
703 \wxheading{Derived from
}
705 \helpref{wxLog
}{wxlog
}
707 \wxheading{Include files
}
713 \helpref{wxBase
}{librarieslist
}
717 \helpref{wxLogStderr
}{wxlogstderr
},\\
718 \helpref{wxStreamToTextRedirector
}{wxstreamtotextredirector
}
720 \latexignore{\rtfignore{\wxheading{Members
}}}
722 \membersection{wxLogStream::wxLogStream
}\label{wxlogstreamctor
}
724 \func{}{wxLogStream
}{\param{std::ostream
}{*ostr = NULL
}}
726 Constructs a log target which sends all the log messages to the given
727 output stream. If it is
{\tt NULL
}, the messages are sent to
{\tt cerr
}.
729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogTextCtrl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
731 \section{\class{wxLogTextCtrl
}}\label{wxlogtextctrl
}
733 Using these target all the log messages can be redirected to a text control.
734 The text control must have been created with
{\tt wxTE
\_MULTILINE} style by the
737 \wxheading{Derived from
}
739 \helpref{wxLog
}{wxlog
}
741 \wxheading{Include files
}
747 \helpref{wxTextCtrl
}{wxtextctrl
},\\
748 \helpref{wxStreamToTextRedirector
}{wxstreamtotextredirector
}
750 \latexignore{\rtfignore{\wxheading{Members
}}}
752 \membersection{wxLogTextCtrl::wxLogTextCtrl
}\label{wxlogtextctrlctor
}
754 \func{}{wxLogTextCtrl
}{\param{wxTextCtrl
}{*textctrl
}}
756 Constructs a log target which sends all the log messages to the given text
757 control. The
{\it textctrl
} parameter cannot be
{\tt NULL
}.
759 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogWindow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
761 \section{\class{wxLogWindow
}}\label{wxlogwindow
}
763 This class represents a background log window: to be precise, it collects all
764 log messages in the log frame which it manages but also passes them on to the
765 log target which was active at the moment of its creation. This allows, for
766 example, to show all the log messages in a frame but still continue to process
767 them normally by showing the standard log dialog.
769 \wxheading{Derived from
}
771 \helpref{wxLogInterposer
}{wxloginterposer
}\\
772 \helpref{wxLogChain
}{wxlogchain
}\\
773 \helpref{wxLog
}{wxlog
}
775 \wxheading{Include files
}
781 \helpref{wxLogTextCtrl
}{wxlogtextctrl
}
783 \latexignore{\rtfignore{\wxheading{Members
}}}
785 \membersection{wxLogWindow::wxLogWindow
}\label{wxlogwindowctor
}
787 \func{}{wxLogWindow
}{\param{wxFrame
}{*parent
},
\param{const wxChar
}{*title
},
\param{bool
}{show =
{\tt true
}},
\param{bool
}{passToOld =
{\tt true
}}}
789 Creates the log frame window and starts collecting the messages in it.
791 \wxheading{Parameters
}
793 \docparam{parent
}{The parent window for the log frame, may be
{\tt NULL
}}
795 \docparam{title
}{The title for the log frame
}
797 \docparam{show
}{{\tt true
} to show the frame initially (default), otherwise
798 \helpref{wxLogWindow::Show
}{wxlogwindowshow
} must be called later.
}
800 \docparam{passToOld
}{{\tt true
} to process the log messages normally in addition to
801 logging them in the log frame (default),
{\tt false
} to only log them in the
804 \membersection{wxLogWindow::Show
}\label{wxlogwindowshow
}
806 \func{void
}{Show
}{\param{bool
}{show =
{\tt true
}}}
808 Shows or hides the frame.
810 \membersection{wxLogWindow::GetFrame
}\label{wxlogwindowgetframe
}
812 \constfunc{wxFrame *
}{GetFrame
}{\void}
814 Returns the associated log frame window. This may be used to position or resize
815 it but use
\helpref{wxLogWindow::Show
}{wxlogwindowshow
} to show or hide it.
817 \membersection{wxLogWindow::OnFrameCreate
}\label{wxlogwindowonframecreate
}
819 \func{virtual void
}{OnFrameCreate
}{\param{wxFrame
}{*frame
}}
821 Called immediately after the log frame creation allowing for
822 any extra initializations.
824 \membersection{wxLogWindow::OnFrameClose
}\label{wxlogwindowonframeclose
}
826 \func{virtual bool
}{OnFrameClose
}{\param{wxFrame
}{*frame
}}
828 Called if the user closes the window interactively, will not be
829 called if it is destroyed for another reason (such as when program
832 Return
{\tt true
} from here to allow the frame to close,
{\tt false
} to
833 prevent this from happening.
837 \helpref{wxLogWindow::OnFrameDelete
}{wxlogwindowonframedelete
}
839 \membersection{wxLogWindow::OnFrameDelete
}\label{wxlogwindowonframedelete
}
841 \func{virtual void
}{OnFrameDelete
}{\param{wxFrame
}{*frame
}}
843 Called right before the log frame is going to be deleted: will
844 always be called unlike
\helpref{OnFrameClose()
}{wxlogwindowonframeclose
}.