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