]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/log.tex
added the static function GetLabelText() to wxStaticText which was mentioned in the...
[wxWidgets.git] / docs / latex / wx / log.tex
... / ...
CommitLineData
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: log.tex
3%% Purpose: wxLog and related classes documentation
4%% Author: Vadim Zeitlin
5%% Modified by:
6%% Created: some time ago
7%% RCS-ID: $Id$
8%% Copyright: (c) 1997-2001 Vadim Zeitlin
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxLog}}\label{wxlog}
13
14wxLog class defines the interface for the {\it log targets} used by wxWidgets
15logging functions as explained in the \helpref{wxLog overview}{wxlogoverview}.
16The only situations when you need to directly use this class is when you want
17to derive your own log target because the existing ones don't satisfy your
18needs. Another case is if you wish to customize the behaviour of the standard
19logging classes (all of which respect the wxLog settings): for example, set
20which trace messages are logged and which are not or change (or even remove
21completely) the timestamp on the messages.
22
23Otherwise, it is completely hidden behind the {\it wxLogXXX()} functions and
24you may not even know about its existence.
25
26See \helpref{log overview}{wxlogoverview} for the descriptions of wxWidgets
27logging facilities.
28
29\wxheading{Derived from}
30
31No base class
32
33\wxheading{Include files}
34
35<wx/log.h>
36
37\wxheading{Library}
38
39\helpref{wxCore}{librarieslist}
40
41\latexignore{\rtfignore{\wxheading{Function groups}}}
42
43\membersection{Global functions}
44
45The functions in this section work with and manipulate the active log target.
46The \helpref{OnLog()}{wxlogonlog} is called by the {\it wxLogXXX()} functions
47and invokes the \helpref{DoLog()}{wxlogdolog} of the active log target if any.
48Get/Set methods are used to install/query the current active target and,
49finally, \helpref{DontCreateOnDemand()}{wxlogdontcreateondemand} disables the
50automatic creation of a standard log target if none actually exists. It is
51only useful when the application is terminating and shouldn't be used in other
52situations because it may easily lead to a loss of messages.
53
54\helpref{OnLog}{wxlogonlog}\\
55\helpref{GetActiveTarget}{wxloggetactivetarget}\\
56\helpref{SetActiveTarget}{wxlogsetactivetarget}\\
57\helpref{DontCreateOnDemand}{wxlogdontcreateondemand}\\
58\helpref{Suspend}{wxlogsuspend}\\
59\helpref{Resume}{wxlogresume}
60
61\membersection{Logging functions}\label{loggingfunctions}
62
63There are two functions which must be implemented by any derived class to
64actually process the log messages: \helpref{DoLog}{wxlogdolog} and
65\helpref{DoLogString}{wxlogdologstring}. The second function receives a string
66which just has to be output in some way and the easiest way to write a new log
67target is to override just this function in the derived class. If more control
68over the output format is needed, then the first function must be overridden
69which allows to construct custom messages depending on the log level or even
70do completely different things depending on the message severity (for example,
71throw away all messages except warnings and errors, show warnings on the
72screen and forward the error messages to the user's (or programmer's) cell
73phone - maybe depending on whether the timestamp tells us if it is day or
74night in the current time zone).
75
76There also functions to support message buffering. Why are they needed?
77Some of wxLog implementations, most notably the standard wxLogGui class,
78buffer the messages (for example, to avoid showing the user a zillion of modal
79message boxes one after another -- which would be really annoying).
80\helpref{Flush()}{wxlogflush} shows them all and clears the buffer contents.
81This function doesn't do anything if the buffer is already empty.
82
83\helpref{Flush}{wxlogflush}\\
84\helpref{FlushActive}{wxlogflushactive}
85
86\membersection{Customization}\label{wxlogcustomization}
87
88The functions below allow some limited customization of wxLog behaviour
89without writing a new log target class (which, aside of being a matter of
90several minutes, allows you to do anything you want).
91
92The verbose messages are the trace messages which are not disabled in the
93release mode and are generated by \helpref{wxLogVerbose}{wxlogverbose}. They
94are not normally shown to the user because they present little interest, but
95may be activated, for example, in order to help the user find some program
96problem.
97
98As for the (real) trace messages, their handling depends on the settings of
99the (application global) {\it trace mask}. There are two ways to specify it:
100either 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.
104
105The difference between bit-wise and string trace masks is that a message using
106integer trace mask will only be logged if all bits of the mask are set in the
107current mask while a message using string mask will be logged simply if the
108mask had been added before to the list of allowed ones.
109
110For example,
111
112\begin{verbatim}
113// wxTraceOleCalls is one of standard bit masks
114wxLogTrace(wxTraceRefCount | wxTraceOleCalls, "Active object ref count: %d", nRef);
115\end{verbatim}
116will do something only if the current trace mask contains both
117{\tt wxTraceRefCount} and {\tt wxTraceOle}, but
118
119\begin{verbatim}
120// wxTRACE_OleCalls is one of standard string masks
121wxLogTrace(wxTRACE_OleCalls, "IFoo::Bar() called");
122\end{verbatim}
123
124will log the message if it was preceded by
125
126\begin{verbatim}
127wxLog::AddTraceMask(wxTRACE_OleCalls);
128\end{verbatim}
129
130Using string masks is simpler and allows to easily add custom ones, so this is
131the preferred way of working with trace messages. The integer trace mask is
132kept for compatibility and for additional (but very rarely needed) flexibility
133only.
134
135The standard trace masks are given in \helpref{wxLogTrace}{wxlogtrace}
136documentation.
137
138Finally, the {\it wxLog::DoLog()} function automatically prepends a time stamp
139to all the messages. The format of the time stamp may be changed: it can be
140any string with \% specifications fully described in the documentation of the
141standard {\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
144format disables timestamping of the messages completely.
145
146{\bf NB:} Timestamping is disabled for Visual C++ users in debug builds by
147default because otherwise it would be impossible to directly go to the line
148from which the log message was generated by simply clicking in the debugger
149window on the corresponding error message. If you wish to enable it, please use
150\helpref{SetTimestamp}{wxlogsettimestamp} explicitly.
151
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}
165
166%%%%% MEMBERS HERE %%%%%
167\helponly{\insertatlevel{2}{
168
169\wxheading{Members}
170
171}}
172
173\membersection{wxLog::AddTraceMask}\label{wxlogaddtracemask}
174
175\func{static void}{AddTraceMask}{\param{const wxString\& }{mask}}
176
177Add the {\it mask} to the list of allowed masks for
178\helpref{wxLogTrace}{wxlogtrace}.
179
180\wxheading{See also}
181
182\helpref{RemoveTraceMask}{wxlogremovetracemask}
183\helpref{GetTraceMasks}{wxloggettracemasks}
184
185\membersection{wxLog::ClearTraceMasks}\label{wxlogcleartracemasks}
186
187\func{static void}{ClearTraceMasks}{\void}
188
189Removes all trace masks previously set with
190\helpref{AddTraceMask}{wxlogaddtracemask}.
191
192\wxheading{See also}
193
194\helpref{RemoveTraceMask}{wxlogremovetracemask}
195
196\membersection{wxLog::GetTraceMasks}\label{wxloggettracemasks}
197
198\func{static const wxArrayString \&}{GetTraceMasks}{\void}
199
200Returns the currently allowed list of string trace masks.
201
202\wxheading{See also}
203
204\helpref{AddTraceMask}{wxlogaddtracemask}.
205
206\membersection{wxLog::OnLog}\label{wxlogonlog}
207
208\func{static void}{OnLog}{\param{wxLogLevel }{ level}, \param{const wxString\& }{ message}}
209
210Forwards the message at specified level to the {\it DoLog()} function of the
211active log target if there is any, does nothing otherwise.
212
213\membersection{wxLog::GetActiveTarget}\label{wxloggetactivetarget}
214
215\func{static wxLog *}{GetActiveTarget}{\void}
216
217Returns the pointer to the active log target (may be NULL).
218
219\membersection{wxLog::SetActiveTarget}\label{wxlogsetactivetarget}
220
221\func{static wxLog *}{SetActiveTarget}{\param{wxLog * }{ logtarget}}
222
223Sets the specified log target as the active one. Returns the pointer to the
224previous active log target (may be NULL). To suppress logging use a new
225instance of wxLogNull not NULL. If the active log target is set to NULL a
226new default log target will be created when logging occurs.
227
228\membersection{wxLog::Suspend}\label{wxlogsuspend}
229
230\func{static void}{Suspend}{\void}
231
232Suspends the logging until \helpref{Resume}{wxlogresume} is called. Note that
233the latter must be called the same number of times as the former to undo it,
234i.e. if you call Suspend() twice you must call Resume() twice as well.
235
236Note that suspending the logging means that the log sink won't be be flushed
237periodically, it doesn't have any effect if the current log target does the
238logging immediately without waiting for \helpref{Flush}{wxlogflush} to be
239called (the standard GUI log target only shows the log dialog when it is
240flushed, so Suspend() works as expected with it).
241
242\wxheading{See also}
243
244\helpref{Resume}{wxlogresume},\\
245\helpref{wxLogNull}{wxlogoverview}
246
247\membersection{wxLog::Resume}\label{wxlogresume}
248
249\func{static void}{Resume}{\void}
250
251Resumes logging previously suspended by a call to
252\helpref{Suspend}{wxlogsuspend}. All messages logged in the meanwhile will be
253flushed soon.
254
255\membersection{wxLog::DoLog}\label{wxlogdolog}
256
257\func{virtual void}{DoLog}{\param{wxLogLevel }{level}, \param{const wxString\& }{msg}, \param{time\_t }{timestamp}}
258
259Called to process the message of the specified severity. {\it msg} is the text
260of the message as specified in the call of {\it wxLogXXX()} function which
261generated it and {\it timestamp} is the moment when the message was generated.
262
263The base class version prepends the timestamp to the message, adds a prefix
264corresponding to the log level and then calls
265\helpref{DoLogString}{wxlogdologstring} with the resulting string.
266
267\membersection{wxLog::DoLogString}\label{wxlogdologstring}
268
269\func{virtual void}{DoLogString}{\param{const wxString\& }{msg}, \param{time\_t }{timestamp}}
270
271Called to log the specified string. The timestamp is already included in the
272string but still passed to this function.
273
274A simple implementation may just send the string to {\tt stdout} or, better,
275{\tt stderr}.
276
277\membersection{wxLog::DontCreateOnDemand}\label{wxlogdontcreateondemand}
278
279\func{static void}{DontCreateOnDemand}{\void}
280
281Instructs wxLog to not create new log targets on the fly if there is none
282currently. (Almost) for internal use only: it is supposed to be called by the
283application shutdown code.
284
285Note that this function also calls
286\helpref{ClearTraceMasks}{wxlogcleartracemasks}.
287
288\membersection{wxLog::Flush}\label{wxlogflush}
289
290\func{virtual void}{Flush}{\void}
291
292Shows all the messages currently in buffer and clears it. If the buffer
293is already empty, nothing happens.
294
295\membersection{wxLog::FlushActive}\label{wxlogflushactive}
296
297\func{static void}{FlushActive}{\void}
298
299Flushes the current log target if any, does nothing if there is none.
300
301\wxheading{See also}
302
303\helpref{Flush}{wxlogflush}
304
305\membersection{wxLog::SetVerbose}\label{wxlogsetverbose}
306
307\func{static void}{SetVerbose}{\param{bool }{ verbose = true}}
308
309Activates or deactivates verbose mode in which the verbose messages are
310logged as the normal ones instead of being silently dropped.
311
312\membersection{wxLog::GetVerbose}\label{wxloggetverbose}
313
314\func{static bool}{GetVerbose}{\void}
315
316Returns whether the verbose mode is currently active.
317
318\membersection{wxLog::SetLogLevel}\label{wxlogsetloglevel}
319
320\func{static void}{SetLogLevel}{\param{wxLogLevel }{ logLevel}}
321
322Specifies that log messages with $level > logLevel$ should be ignored
323and not sent to the active log target.
324
325\membersection{wxLog::GetLogLevel}\label{wxloggetloglevel}
326
327\func{static wxLogLevel}{GetLogLevel}{\void}
328
329Returns the current log level limit.
330
331\membersection{wxLog::SetRepetitionCounting}\label{wxlogsetrepetitioncounting}
332
333\func{static void}{SetRepetitionCounting}{\param{bool }{ repetCounting = true}}
334
335Enables logging mode in which a log message is logged once, and in case exactly
336the same message successively repeats one or more times, only the number of
337repetitions is logged.
338
339\membersection{wxLog::GetRepetitionCounting}\label{wxloggetrepetitioncounting}
340
341\func{static bool}{GetRepetitionCounting}{\void}
342
343Returns whether the repetition counting mode is enabled.
344
345
346\membersection{wxLog::SetTimestamp}\label{wxlogsettimestamp}
347
348\func{static void}{SetTimestamp}{\param{const wxString\&}{ format}}
349
350Sets the timestamp format prepended by the default log targets to all
351messages. The string may contain any normal characters as well as \%
352prefixed format specificators, see {\it strftime()} manual for details.
353Passing an empty string to this function disables message time stamping.
354
355\membersection{wxLog::DisableTimestamp}\label{wxlogdisabletimestamp}
356
357\func{void}{SetTimestamp}{\param{const wxString\&}{ format}}
358
359Disables time stamping of the log messages.
360
361\newsince{2.9}
362
363\membersection{wxLog::GetTimestamp}\label{wxloggettimestamp}
364
365\func{static const wxString\&}{GetTimestamp}{\void}
366
367Returns the current timestamp format string.
368
369\membersection{wxLog::SetTraceMask}\label{wxlogsettracemask}
370
371\func{static void}{SetTraceMask}{\param{wxTraceMask }{ mask}}
372
373Sets the trace mask, see \helpref{Customization}{wxlogcustomization}
374section for details.
375
376\membersection{wxLog::GetTraceMask}\label{wxloggettracemask}
377
378\func{static wxTraceMask}{GetTraceMask}{\void}
379
380Returns the current trace mask, see \helpref{Customization}{wxlogcustomization} section
381for details.
382
383\membersection{wxLog::IsAllowedTraceMask}\label{wxlogisallowedtracemask}
384
385\func{static bool}{IsAllowedTraceMask}{\param{const wxString\& }{mask}}
386
387Returns true if the {\it mask} is one of allowed masks for
388\helpref{wxLogTrace}{wxlogtrace}.
389
390See also: \helpref{AddTraceMask}{wxlogaddtracemask},
391\helpref{RemoveTraceMask}{wxlogremovetracemask}
392
393\membersection{wxLog::RemoveTraceMask}\label{wxlogremovetracemask}
394
395\func{static void}{RemoveTraceMask}{\param{const wxString\& }{mask}}
396
397Remove the {\it mask} from the list of allowed masks for
398\helpref{wxLogTrace}{wxlogtrace}.
399
400See also: \helpref{AddTraceMask}{wxlogaddtracemask}
401
402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogChain %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
403
404\section{\class{wxLogChain}}\label{wxlogchain}
405
406This simple class allows to chain log sinks, that is to install a new sink but
407keep passing log messages to the old one instead of replacing it completely as
408\helpref{SetActiveTarget}{wxlogsetactivetarget} does.
409
410It is especially useful when you want to divert the logs somewhere (for
411example to a file or a log window) but also keep showing the error messages
412using the standard dialogs as \helpref{wxLogGui}{wxlogoverview} does by default.
413
414Example of usage:
415
416\begin{verbatim}
417wxLogChain *logChain = new wxLogChain(new wxLogStderr);
418
419// all the log messages are sent to stderr and also processed as usually
420...
421
422// don't delete logChain directly as this would leave a dangling
423// pointer as active log target, use SetActiveTarget() instead
424delete wxLog::SetActiveTarget(...something else or NULL...);
425
426\end{verbatim}
427
428\wxheading{Derived from}
429
430\helpref{wxLog}{wxlog}
431
432\wxheading{Include files}
433
434<wx/log.h>
435
436\wxheading{Library}
437
438\helpref{wxBase}{librarieslist}
439
440\latexignore{\rtfignore{\wxheading{Members}}}
441
442\membersection{wxLogChain::wxLogChain}\label{wxlogchainctor}
443
444\func{}{wxLogChain}{\param{wxLog *}{logger}}
445
446Sets the specified {\tt logger} (which may be {\tt NULL}) as the default log
447target but the log messages are also passed to the previous log target if any.
448
449\membersection{wxLogChain::\destruct{wxLogChain}}\label{wxlogchaindtor}
450
451\func{}{\destruct{wxLogChain}}{\void}
452
453Destroys the previous log target.
454
455\membersection{wxLogChain::DetachOldLog}\label{wxlogchaindetacholdlog}
456
457\func{void}{DetachOldLog}{\void}
458
459Detaches the old log target so it won't be destroyed when the wxLogChain object
460is destroyed.
461
462\membersection{wxLogChain::GetOldLog}\label{wxlogchaingetoldlog}
463
464\constfunc{wxLog *}{GetOldLog}{\void}
465
466Returns the pointer to the previously active log target (which may be {\tt
467NULL}).
468
469\membersection{wxLogChain::IsPassingMessages}\label{wxlogchainispassingmessages}
470
471\constfunc{bool}{IsPassingMessages}{\void}
472
473Returns {\tt true} if the messages are passed to the previously active log
474target (default) or {\tt false} if \helpref{PassMessages}{wxlogchainpassmessages}
475had been called.
476
477\membersection{wxLogChain::PassMessages}\label{wxlogchainpassmessages}
478
479\func{void}{PassMessages}{\param{bool }{passMessages}}
480
481By default, the log messages are passed to the previously active log target.
482Calling this function with {\tt false} parameter disables this behaviour
483(presumably temporarily, as you shouldn't use wxLogChain at all otherwise) and
484it can be reenabled by calling it again with {\it passMessages} set to {\tt
485true}.
486
487\membersection{wxLogChain::SetLog}\label{wxlogchainsetlog}
488
489\func{void}{SetLog}{\param{wxLog *}{logger}}
490
491Sets another log target to use (may be {\tt NULL}). The log target specified
492in the \helpref{constructor}{wxlogchainctor} or in a previous call to
493this function is deleted.
494
495This doesn't change the old log target value (the one the messages are
496forwarded to) which still remains the same as was active when wxLogChain
497object was created.
498
499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogGui %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
500
501\section{\class{wxLogGui}}\label{wxloggui}
502
503This is the default log target for the GUI wxWidgets applications. It is passed
504to \helpref{wxLog::SetActiveTarget}{wxlogsetactivetarget} at the program
505startup and is deleted by wxWidgets during the program shut down.
506
507\wxheading{Derived from}
508
509\helpref{wxLog}{wxlog}
510
511\wxheading{Include files}
512
513<wx/log.h>
514
515\latexignore{\rtfignore{\wxheading{Members}}}
516
517\membersection{wxLogGui::wxLogGui}\label{wxlogguictor}
518
519\func{}{wxLogGui}{\void}
520
521Default constructor.
522
523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogNull %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
524
525\section{\class{wxLogNull}}\label{wxlognull}
526
527This class allows to temporarily suspend logging. All calls to the log
528functions during the life time of an object of this class are just ignored.
529
530In particular, it can be used to suppress the log messages given by wxWidgets
531itself but it should be noted that it is rarely the best way to cope with this
532problem as {\bf all} log messages are suppressed, even if they indicate a
533completely different error than the one the programmer wanted to suppress.
534
535For instance, the example of the overview:
536
537{\small
538\begin{verbatim}
539 wxFile file;
540
541 // wxFile.Open() normally complains if file can't be opened, we don't want it
542 {
543 wxLogNull logNo;
544 if ( !file.Open("bar") )
545 ... process error ourselves ...
546 } // ~wxLogNull called, old log sink restored
547
548 wxLogMessage("..."); // ok
549\end{verbatim}
550}%
551
552would be better written as:
553
554{\small
555\begin{verbatim}
556 wxFile file;
557
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") )
561 {
562 // gives an error message if the file couldn't be opened
563 file.Open("bar");
564 }
565 else
566 {
567 ...
568 }
569\end{verbatim}
570}%
571
572\wxheading{Derived from}
573
574\helpref{wxLog}{wxlog}
575
576\wxheading{Include files}
577
578<wx/log.h>
579
580\wxheading{Library}
581
582\helpref{wxBase}{librarieslist}
583
584\latexignore{\rtfignore{\wxheading{Members}}}
585
586\membersection{wxLogNull::wxLogNull}\label{wxlognullctor}
587
588\func{}{wxLogNull}{\void}
589
590Suspends logging.
591
592\membersection{wxLogNull::\destruct{wxLogNull}}\label{wxlognulldtor}
593
594Resumes logging.
595
596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogInterposer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
597
598\section{\class{wxLogInterposer}}\label{wxloginterposer}
599
600A special version of \helpref{wxLogChain}{wxlogchain} which uses itself as the
601new log target. It forwards log messages to the previously installed one in addition to
602processing them itself.
603
604Unlike \helpref{wxLogChain}{wxlogchain} which is usually used directly as is,
605this class must be derived from to implement \helpref{DoLog}{wxlogdolog}
606and/or \helpref{DoLogString}{wxlogdologstring} methods.
607
608wxLogInterposer destroys the previous log target in its destructor. If you
609don't want this to happen, use wxLogInterposerTemp instead.
610
611\wxheading{Derived from}
612
613\helpref{wxLogChain}{wxlogchain}
614
615\wxheading{Include files}
616
617<wx/log.h>
618
619\wxheading{Library}
620
621\helpref{wxBase}{librarieslist}
622
623\latexignore{\rtfignore{\wxheading{Members}}}
624
625\membersection{wxLogInterposer::wxLogInterposer}\label{wxloginterposerctor}
626
627The default constructor installs this object as the current active log target.
628
629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogInterposerTemp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
630
631\section{\class{wxLogInterposerTemp}}\label{wxloginterposertemp}
632
633A special version of \helpref{wxLogChain}{wxlogchain} which uses itself as the
634new log target. It forwards log messages to the previously installed one in addition to
635processing them itself. Unlike \helpref{wxLogInterposer}{wxloginterposer}, it doesn't
636delete the old target which means it can be used to temporarily redirect log output.
637
638As per wxLogInterposer, this class must be derived from to implement \helpref{DoLog}{wxlogdolog}
639and/or \helpref{DoLogString}{wxlogdologstring} methods.
640
641\wxheading{Derived from}
642
643\helpref{wxLogChain}{wxlogchain}
644
645\wxheading{Include files}
646
647<wx/log.h>
648
649\wxheading{Library}
650
651\helpref{wxBase}{librarieslist}
652
653\latexignore{\rtfignore{\wxheading{Members}}}
654
655\membersection{wxLogInterposerTemp::wxLogInterposerTemp}\label{wxloginterposertempctor}
656
657The default constructor installs this object as the current active log target.
658
659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogStderr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
660
661\section{\class{wxLogStderr}}\label{wxlogstderr}
662
663This class can be used to redirect the log messages to a C file stream (not to
664be confused with C++ streams). It is the default log target for the non-GUI
665wxWidgets applications which send all the output to {\tt stderr}.
666
667\wxheading{Derived from}
668
669\helpref{wxLog}{wxlog}
670
671\wxheading{Include files}
672
673<wx/log.h>
674
675\wxheading{Library}
676
677\helpref{wxBase}{librarieslist}
678
679\wxheading{See also}
680
681\helpref{wxLogStream}{wxlogstream}
682
683\latexignore{\rtfignore{\wxheading{Members}}}
684
685\membersection{wxLogStderr::wxLogStderr}\label{wxlogstderrctor}
686
687\func{}{wxLogStderr}{\param{FILE }{*fp = NULL}}
688
689Constructs a log target which sends all the log messages to the given
690{\tt FILE}. If it is {\tt NULL}, the messages are sent to {\tt stderr}.
691
692%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogStream %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
693
694\section{\class{wxLogStream}}\label{wxlogstream}
695
696This class can be used to redirect the log messages to a C++ stream.
697
698Please note that this class is only available if wxWidgets was compiled with
699the standard iostream library support ({\tt wxUSE\_STD\_IOSTREAM} must be on).
700
701\wxheading{Derived from}
702
703\helpref{wxLog}{wxlog}
704
705\wxheading{Include files}
706
707<wx/log.h>
708
709\wxheading{Library}
710
711\helpref{wxBase}{librarieslist}
712
713\wxheading{See also}
714
715\helpref{wxLogStderr}{wxlogstderr},\\
716\helpref{wxStreamToTextRedirector}{wxstreamtotextredirector}
717
718\latexignore{\rtfignore{\wxheading{Members}}}
719
720\membersection{wxLogStream::wxLogStream}\label{wxlogstreamctor}
721
722\func{}{wxLogStream}{\param{std::ostream }{*ostr = NULL}}
723
724Constructs a log target which sends all the log messages to the given
725output stream. If it is {\tt NULL}, the messages are sent to {\tt cerr}.
726
727%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogTextCtrl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
728
729\section{\class{wxLogTextCtrl}}\label{wxlogtextctrl}
730
731Using these target all the log messages can be redirected to a text control.
732The text control must have been created with {\tt wxTE\_MULTILINE} style by the
733caller previously.
734
735\wxheading{Derived from}
736
737\helpref{wxLog}{wxlog}
738
739\wxheading{Include files}
740
741<wx/log.h>
742
743\wxheading{See also}
744
745\helpref{wxTextCtrl}{wxtextctrl},\\
746\helpref{wxStreamToTextRedirector}{wxstreamtotextredirector}
747
748\latexignore{\rtfignore{\wxheading{Members}}}
749
750\membersection{wxLogTextCtrl::wxLogTextCtrl}\label{wxlogtextctrlctor}
751
752\func{}{wxLogTextCtrl}{\param{wxTextCtrl }{*textctrl}}
753
754Constructs a log target which sends all the log messages to the given text
755control. The {\it textctrl} parameter cannot be {\tt NULL}.
756
757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxLogWindow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
758
759\section{\class{wxLogWindow}}\label{wxlogwindow}
760
761This class represents a background log window: to be precise, it collects all
762log messages in the log frame which it manages but also passes them on to the
763log target which was active at the moment of its creation. This allows, for
764example, to show all the log messages in a frame but still continue to process
765them normally by showing the standard log dialog.
766
767\wxheading{Derived from}
768
769\helpref{wxLogInterposer}{wxloginterposer}
770
771\wxheading{Include files}
772
773<wx/log.h>
774
775\wxheading{See also}
776
777\helpref{wxLogTextCtrl}{wxlogtextctrl}
778
779\latexignore{\rtfignore{\wxheading{Members}}}
780
781\membersection{wxLogWindow::wxLogWindow}\label{wxlogwindowctor}
782
783\func{}{wxLogWindow}{\param{wxFrame }{*parent}, \param{const wxChar }{*title}, \param{bool }{show = {\tt true}}, \param{bool }{passToOld = {\tt true}}}
784
785Creates the log frame window and starts collecting the messages in it.
786
787\wxheading{Parameters}
788
789\docparam{parent}{The parent window for the log frame, may be {\tt NULL}}
790
791\docparam{title}{The title for the log frame}
792
793\docparam{show}{{\tt true} to show the frame initially (default), otherwise
794\helpref{wxLogWindow::Show}{wxlogwindowshow} must be called later.}
795
796\docparam{passToOld}{{\tt true} to process the log messages normally in addition to
797logging them in the log frame (default), {\tt false} to only log them in the
798log frame.}
799
800\membersection{wxLogWindow::Show}\label{wxlogwindowshow}
801
802\func{void}{Show}{\param{bool }{show = {\tt true}}}
803
804Shows or hides the frame.
805
806\membersection{wxLogWindow::GetFrame}\label{wxlogwindowgetframe}
807
808\constfunc{wxFrame *}{GetFrame}{\void}
809
810Returns the associated log frame window. This may be used to position or resize
811it but use \helpref{wxLogWindow::Show}{wxlogwindowshow} to show or hide it.
812
813\membersection{wxLogWindow::OnFrameCreate}\label{wxlogwindowonframecreate}
814
815\func{virtual void}{OnFrameCreate}{\param{wxFrame }{*frame}}
816
817Called immediately after the log frame creation allowing for
818any extra initializations.
819
820\membersection{wxLogWindow::OnFrameClose}\label{wxlogwindowonframeclose}
821
822\func{virtual bool}{OnFrameClose}{\param{wxFrame }{*frame}}
823
824Called if the user closes the window interactively, will not be
825called if it is destroyed for another reason (such as when program
826exits).
827
828Return {\tt true} from here to allow the frame to close, {\tt false} to
829prevent this from happening.
830
831\wxheading{See also}
832
833\helpref{wxLogWindow::OnFrameDelete}{wxlogwindowonframedelete}
834
835\membersection{wxLogWindow::OnFrameDelete}\label{wxlogwindowonframedelete}
836
837\func{virtual void}{OnFrameDelete}{\param{wxFrame }{*frame}}
838
839Called right before the log frame is going to be deleted: will
840always be called unlike \helpref{OnFrameClose()}{wxlogwindowonframeclose}.
841