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