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