]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/log.tex
Removed DrawOpenSpline since it doesn't seem to be needed, with required changes
[wxWidgets.git] / docs / latex / wx / log.tex
CommitLineData
9ee2d31c
VZ
1\section{\class{wxLog}}\label{wxlog}
2
3wxLog class defines the interface for the {\it log targets} used by wxWindows
4logging functions as explained in the \helpref{wxLog overview}{wxlogoverview}.
5The only situations when you need to directly use this class is when you want
6to derive your own log target because the existing ones don't satisfy your
7needs. Another case is if you wish to customize the behaviour of the standard
8logging classes (all of which respect the wxLog settings): for example, set
9which trace messages are logged and which are not or change (or even remove
10completely) the timestamp on the messages.
11
12Otherwise, it is completely hidden behind the {\it wxLogXXX()} functions and
13you may not even know about its existence.
14
15See \helpref{log overview}{wxlogoverview} for the descriptions of wxWindows
16logging facilities.
17
18\wxheading{Derived from}
19
20No base class
21
22\latexignore{\rtfignore{\wxheading{Function groups}}}
23
24\membersection{Static functions}
25
26The functions in this section work with and manipulate the active log target.
27The {\it OnLog()} is called by the {\it wxLogXXX()} functions and invokes the
28{\it DoLog()} of the active log target if any. Get/Set methods are used to
29install/query the current active target and, finally, {\it
30DontCreateOnDemand()} disables the automatic creation of a standard log target
31if none actually exists. It is only useful when the application is terminating
32and shouldn't be used in other situations because it may easily lead to a loss
33of messages.
34
35\helpref{OnLog}{wxlogonlog}\\
36\helpref{GetActiveTarget}{wxloggetactivetarget}\\
37\helpref{SetActiveTarget}{wxsetactivetarget}\\
38\helpref{DontCreateOnDemand}{wxlogdontcreateondemand}
39
40\membersection{Message buffering}
41
42Some of wxLog implementations, most notably the standard
43\helpref{wxLogGui}{wxloggui} class, buffer the messages (for example, to avoid
44showing the user a zillion of modal message boxes one after another - which
45would be really annoying). {\it Flush()} shows them all and clears the buffer
46contents. Although this function doesn't do anything if the buffer is already
47empty, {\it HasPendingMessages()} is also provided which allows to explicitly
48verify it.
49
50\helpref{Flush}{wxlogflush}\\
51\helpref{HasPendingMessages}{haspendingmessages}
52
53\membersection{Customization}{wxlogcustomization}
54
55The functions below allow some limited customization of wxLog behaviour
56without writing a new log target class (which, aside of being a matter of
57several minutes, allows you to do anything you want).
58
59The verbose messages are the trace messages which are not disabled in the
60release mode and are generated by {\it wxLogVerbose()}. They are not normally
61shown to the user because they present little interest, but may be activated,
62for example, in order to help the user find some program problem.
63
64As for the (real) trace messages, they come in different kinds:
65\begin{itemize}\itemsep=0pt
66\item{wxTraceMemAlloc} for the messages about creating and deleting objects
67\item{wxTraceMessages} for tracing the windowing system messages/events
68\item{wxTraceResAlloc} for allocating and releasing the system ressources
69\item{wxTraceRefCount} for reference counting related messages
70\item{wxTraceOleCalls} for the OLE (or COM) method invocations (wxMSW only)
71\item{other} the remaining bits are free for user-defined trace levels
72\end{itemize}
73
74The trace mask is a bit mask which tells which (if any) of these trace
75messages are going to be actually logged. For the trace message to appear
76somewhere, all the bits in the mask used in the call to {\it wxLogTrace()}
77function must be set in the current trace mask. For example,
78\begin{verbatim}
79wxLogTrace(wxTraceRefCount | wxTraceOle, "Active object ref count: %d", nRef);
80\end{verbatim}
81will do something only if the current trace mask contains both wxTraceRefCount
82and wxTraceOle.
83
84Finally, the {\it wxLog::DoLog()} function automatically prepends a time stamp
85to all the messages. The format of the time stamp may be changed: it can be
86any string with \% specificators fully described in the documentation of the
87standard {\it strftime()} function. For example, the default format is
88"[\%d/\%b/\%y \%H:\%M:\%S] " which gives something like "[17/Sep/98 22:10:16] "
89(without quotes) for the current date. Setting an empty string as the time
90format disables timestamping of the messages completely.
91
92\helpref{SetVerbose}{wxlogsetverbose}\\
93\helpref{GetVerbose}{wxloggetverbose}\\
94\helpref{SetTimeStampFormat}{wxlogsettimestampformat}\\
95\helpref{GetTimeStampFormat}{wxloggettimestampformat}\\
96\helpref{SetTraceMask}{wxlogsettracemask}\\
97\helpref{GetTraceMask}{wxloggettracemask}
98
99%%%%% MEMBERS HERE %%%%%
100\helponly{\insertatlevel{2}{
101
102\wxheading{Members}
103
104}}
105
106\membersection{wxLog::OnLog}\label{wxlogonlog}
107
108\func{static void}{OnLog}{\param{wxLogLevel }{ level}, \param{const char * }{ message}}
109
110Forwards the message at specified level to the {\it DoLog()} function of the
111active log target if there is any, does nothing otherwise.
112
113\membersection{wxLog::GetActiveTarget}\label{wxloggetactivetarget}
114
115\func{static wxLog *}{GetActiveTarget}{\void}
116
117Returns the pointer to the active log target (may be NULL).
118
119\membersection{wxLog::SetActiveTarget}\label{wxlogsetactivetarget}
120
121\func{static wxLog *}{SetActiveTarget}{\param{wxLog * }{ logtarget}}
122
123Sets the specified log target as the active one. Returns the pointer to the
124previous active log target (may be NULL).
125
126\membersection{wxLog::DontCreateOnDemand}\label{wxlogdontcreateondemand}
127
128\func{static void}{DontCreateOnDemand}{\void}
129
130Instructs wxLog to not create new log targets on the fly if there is none
131currently. (Almost) for internal use only.
132
133\membersection{wxLog::Flush}{wxlogflush}
134
135\func{virtual void}{Flush}{\void}
136
137Shows all the messages currently in buffer and clears it. If the buffer
138is already empty, nothing happens.
139
140\membersection{wxLog::HasPendingMessages}{haspendingmessages}
141
142\constfunc{bool}{HasPendingMessages}{\void}
143
144Returns true if there are any messages in the buffer (not yet shown to the
145user). (Almost) for internal use only.
146
147\membersection{wxLog::SetVerbose}{wxlogsetverbose}
148
149\func{void}{SetVerbose}{\param{bool }{ verbose = TRUE}}
150
151Activates or desactivates verbose mode in which the verbose messages are
152logged as the normal ones instead of being silently dropped.
153
154\membersection{wxLog::GetVerbose}{wxloggetverbose}
155
156\constfunc{bool}{GetVerbose}{\void}
157
158Returns whether the verbose mode is currently active.
159
160\membersection{wxLog::SetTimeStampFormat}{wxlogsettimestampformat}
161
162\func{void}{SetTimeStampFormat}{\param{const char * }{ format}}
163
164Sets the timestamp format prepended by the default log targets to all
165messages. The string may contain any normal characters as well as \%
166prefixed format specificators, see {\it strftime()} manual for details.
167Passing an empty string to this function disables message timestamping.
168
169\membersection{wxLog::GetTimeStampFormat}{wxloggettimestampformat}
170
171\constfunc{const char *}{GetTimeStampFormat}{\void}
172
173Returns the current timestamp format string.
174
175\membersection{wxLog::SetTraceMask}{wxlogsettracemask}
176
177\func{static void}{SetTraceMask}{\param{wxTraceMask }{ mask}}
178
179Sets the trace mask, see \helpref{Customization}{wxlogcustomization}
180section for details.
181
182\membersection{wxLog::GetTraceMask}{wxloggettracemask}
183
184Returns the current trace mask, see \helpref{Customization}{wxlogcustomization}
185section for details.