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