Coverage Report

Created: 2026-06-15 06:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/logging-log4cxx/src/main/include/log4cxx/logger.h
Line
Count
Source
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
#ifndef _LOG4CXX_LOGGER_H
19
#define _LOG4CXX_LOGGER_H
20
21
#include <log4cxx/spi/appenderattachable.h>
22
#include <log4cxx/level.h>
23
#include <log4cxx/helpers/pool.h>
24
#include <log4cxx/spi/location/locationinfo.h>
25
#include <log4cxx/helpers/resourcebundle.h>
26
#include <log4cxx/helpers/asyncbuffer.h>
27
#include <log4cxx/helpers/messagebuffer.h>
28
29
namespace LOG4CXX_NS
30
{
31
32
namespace spi
33
{
34
class LoggerRepository;
35
LOG4CXX_PTR_DEF(LoggerRepository);
36
class LoggerFactory;
37
LOG4CXX_PTR_DEF(LoggerFactory);
38
}
39
40
class Logger;
41
/** smart pointer to a Logger class */
42
LOG4CXX_PTR_DEF(Logger);
43
LOG4CXX_LIST_DEF(LoggerList, LoggerPtr);
44
45
46
/**
47
This is the central class in the log4cxx package. Most logging
48
operations, except configuration, are done through this class.
49
*/
50
class LOG4CXX_EXPORT Logger
51
  : public virtual spi::AppenderAttachable
52
{
53
  public:
54
    DECLARE_ABSTRACT_LOG4CXX_OBJECT(Logger)
55
0
    BEGIN_LOG4CXX_CAST_MAP()
56
0
    LOG4CXX_CAST_ENTRY(Logger)
57
0
    LOG4CXX_CAST_ENTRY(spi::AppenderAttachable)
58
0
    END_LOG4CXX_CAST_MAP()
59
60
  private:
61
    LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(LoggerPrivate, m_priv)
62
    int m_threshold; //!< The cached level of this logger
63
64
  public:
65
    /**
66
    This constructor initializes a new <code>logger</code> instance and
67
    sets its name.
68
69
    <p>It is intended to be only used by factory-classes.
70
    */
71
    Logger(const LogString& name);
72
#if LOG4CXX_ABI_VERSION <= 15
73
    /// @deprecated This function is deprecated and will be removed in a future version.
74
    [[ deprecated( "Pool is no longer required" ) ]]
75
    Logger(helpers::Pool& pool, const LogString& name);
76
#endif
77
    ~Logger();
78
79
80
    /**
81
    Add <code>newAppender</code> to the list of appenders of this
82
    Logger instance.
83
84
    <p>If <code>newAppender</code> is already in the list of
85
    appenders, then it won't be added again.
86
    */
87
    void addAppender(const AppenderPtr newAppender) override;
88
89
90
#if LOG4CXX_ABI_VERSION <= 15
91
    /**
92
    Call the appenders in the hierrachy starting at
93
    <code>this</code>.  If no appenders could be found, emit a
94
    warning.
95
96
    <p>This method calls all the appenders inherited from the
97
    hierarchy circumventing any evaluation of whether to log or not
98
    to log the particular log request.
99
100
    @param event the event to log.
101
    @param p memory pool for any allocations needed to process request.
102
    @deprecated This function is deprecated and will be removed in a future version.
103
    */
104
    [[ deprecated( "Pool is no longer required" ) ]]
105
    void callAppenders(const spi::LoggingEventPtr& event, helpers::Pool& p) const;
106
#endif
107
    /**
108
    Send \c event to all appenders attached to this or attached to a parent of this.
109
    If no appenders are found, emit a warning.
110
    This method does not check the \c event level.
111
    */
112
    void callAppenders(const spi::LoggingEventPtr& event) const;
113
114
    /**
115
    Close all attached appenders implementing the AppenderAttachable
116
    interface.
117
    */
118
    void closeNestedAppenders();
119
120
    /**
121
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
122
123
    <p>This method first checks if this logger is <code>DEBUG</code>
124
    enabled by comparing the level of this logger with the
125
    DEBUG level. If this logger is
126
    <code>DEBUG</code> enabled, it proceeds to call all the
127
    registered appenders in this logger and also higher in the
128
    hierarchy depending on the value of the additivity flag.
129
130
    @param msg the message string to log.
131
    @param location The source code location of the logging request.
132
    */
133
    void debug(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
134
    /**
135
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
136
137
    <p>This method first checks if this logger is <code>DEBUG</code>
138
    enabled by comparing the level of this logger with the
139
    DEBUG level. If this logger is
140
    <code>DEBUG</code> enabled, it proceeds to call all the
141
    registered appenders in this logger and also higher in the
142
    hierarchy depending on the value of the additivity flag.
143
144
    @param msg the message string to log.
145
146
    See also #LOG4CXX_DEBUG.
147
    */
148
    void debug(const std::string& msg) const;
149
#if LOG4CXX_WCHAR_T_API
150
    /**
151
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
152
153
    <p>This method first checks if this logger is <code>DEBUG</code>
154
    enabled by comparing the level of this logger with the
155
    DEBUG level. If this logger is
156
    <code>DEBUG</code> enabled, it proceeds to call all the
157
    registered appenders in this logger and also higher in the
158
    hierarchy depending on the value of the additivity flag.
159
160
    @param msg the message string to log.
161
    @param location The source code location of the logging request.
162
163
    See also #LOG4CXX_DEBUG.
164
    */
165
    void debug(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
166
    /**
167
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
168
169
    <p>This method first checks if this logger is <code>DEBUG</code>
170
    enabled by comparing the level of this logger with the
171
    DEBUG level. If this logger is
172
    <code>DEBUG</code> enabled, it proceeds to call all the
173
    registered appenders in this logger and also higher in the
174
    hierarchy depending on the value of the additivity flag.
175
176
    @param msg the message string to log.
177
178
    See also #LOG4CXX_DEBUG.
179
    */
180
    void debug(const std::wstring& msg) const;
181
#endif
182
#if LOG4CXX_UNICHAR_API
183
    /**
184
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
185
186
    <p>This method first checks if this logger is <code>DEBUG</code>
187
    enabled by comparing the level of this logger with the
188
    DEBUG level. If this logger is
189
    <code>DEBUG</code> enabled, it proceeds to call all the
190
    registered appenders in this logger and also higher in the
191
    hierarchy depending on the value of the additivity flag.
192
193
    @param msg the message string to log.
194
    @param location The source code location of the logging request.
195
196
    See also #LOG4CXX_DEBUG.
197
    */
198
    void debug(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
199
    /**
200
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
201
202
    <p>This method first checks if this logger is <code>DEBUG</code>
203
    enabled by comparing the level of this logger with the
204
    DEBUG level. If this logger is
205
    <code>DEBUG</code> enabled, it proceeds to call all the
206
    registered appenders in this logger and also higher in the
207
    hierarchy depending on the value of the additivity flag.
208
209
    @param msg the message string to log.
210
211
    See also #LOG4CXX_DEBUG.
212
    */
213
    void debug(const std::basic_string<UniChar>& msg) const;
214
#endif
215
#if LOG4CXX_CFSTRING_API
216
    /**
217
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
218
219
    <p>This method first checks if this logger is <code>DEBUG</code>
220
    enabled by comparing the level of this logger with the
221
    DEBUG level. If this logger is
222
    <code>DEBUG</code> enabled, it proceeds to call all the
223
    registered appenders in this logger and also higher in the
224
    hierarchy depending on the value of the additivity flag.
225
226
    @param msg the message string to log.
227
    @param location The source code location of the logging request.
228
229
    See also #LOG4CXX_DEBUG.
230
    */
231
    void debug(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
232
    /**
233
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
234
235
    <p>This method first checks if this logger is <code>DEBUG</code>
236
    enabled by comparing the level of this logger with the
237
    DEBUG level. If this logger is
238
    <code>DEBUG</code> enabled, it proceeds to call all the
239
    registered appenders in this logger and also higher in the
240
    hierarchy depending on the value of the additivity flag.
241
242
    @param msg the message string to log.
243
244
    See also #LOG4CXX_DEBUG.
245
    */
246
    void debug(const CFStringRef& msg) const;
247
#endif
248
249
    /**
250
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
251
252
    <p>This method first checks if this logger is <code>ERROR</code>
253
    enabled by comparing the level of this logger with the
254
    ERROR level. If this logger is
255
    <code>ERROR</code> enabled, it proceeds to call all the
256
    registered appenders in this logger and also higher in the
257
    hierarchy depending on the value of the additivity flag.
258
259
    @param msg the message string to log.
260
    @param location The source code location of the logging request.
261
262
    See also #LOG4CXX_ERROR.
263
    */
264
    void error(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
265
    /**
266
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
267
268
    <p>This method first checks if this logger is <code>ERROR</code>
269
    enabled by comparing the level of this logger with the
270
    ERROR level. If this logger is
271
    <code>ERROR</code> enabled, it proceeds to call all the
272
    registered appenders in this logger and also higher in the
273
    hierarchy depending on the value of the additivity flag.
274
275
    @param msg the message string to log.
276
277
    See also #LOG4CXX_ERROR.
278
    */
279
    void error(const std::string& msg) const;
280
#if LOG4CXX_WCHAR_T_API
281
    /**
282
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
283
284
    <p>This method first checks if this logger is <code>ERROR</code>
285
    enabled by comparing the level of this logger with the
286
    ERROR level. If this logger is
287
    <code>ERROR</code> enabled, it proceeds to call all the
288
    registered appenders in this logger and also higher in the
289
    hierarchy depending on the value of the additivity flag.
290
291
    @param msg the message string to log.
292
293
    See also #LOG4CXX_ERROR.
294
    */
295
    void error(const std::wstring& msg) const;
296
    /**
297
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
298
299
    <p>This method first checks if this logger is <code>ERROR</code>
300
    enabled by comparing the level of this logger with the
301
    ERROR level. If this logger is
302
    <code>ERROR</code> enabled, it proceeds to call all the
303
    registered appenders in this logger and also higher in the
304
    hierarchy depending on the value of the additivity flag.
305
306
    @param msg the message string to log.
307
    @param location The source code location of the logging request.
308
309
    See also #LOG4CXX_ERROR.
310
    */
311
    void error(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
312
#endif
313
#if LOG4CXX_UNICHAR_API
314
    /**
315
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
316
317
    <p>This method first checks if this logger is <code>ERROR</code>
318
    enabled by comparing the level of this logger with the
319
    ERROR level. If this logger is
320
    <code>ERROR</code> enabled, it proceeds to call all the
321
    registered appenders in this logger and also higher in the
322
    hierarchy depending on the value of the additivity flag.
323
324
    @param msg the message string to log.
325
    @param location The source code location of the logging request.
326
327
    See also #LOG4CXX_ERROR.
328
    */
329
    void error(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
330
    /**
331
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
332
333
    <p>This method first checks if this logger is <code>ERROR</code>
334
    enabled by comparing the level of this logger with the
335
    ERROR level. If this logger is
336
    <code>ERROR</code> enabled, it proceeds to call all the
337
    registered appenders in this logger and also higher in the
338
    hierarchy depending on the value of the additivity flag.
339
340
    @param msg the message string to log.
341
342
    See also #LOG4CXX_ERROR.
343
    */
344
    void error(const std::basic_string<UniChar>& msg) const;
345
#endif
346
#if LOG4CXX_CFSTRING_API
347
    /**
348
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
349
350
    <p>This method first checks if this logger is <code>ERROR</code>
351
    enabled by comparing the level of this logger with the
352
    ERROR level. If this logger is
353
    <code>ERROR</code> enabled, it proceeds to call all the
354
    registered appenders in this logger and also higher in the
355
    hierarchy depending on the value of the additivity flag.
356
357
    @param msg the message string to log.
358
    @param location The source code location of the logging request.
359
360
    See also #LOG4CXX_ERROR.
361
    */
362
    void error(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
363
    /**
364
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
365
366
    <p>This method first checks if this logger is <code>ERROR</code>
367
    enabled by comparing the level of this logger with the
368
    ERROR level. If this logger is
369
    <code>ERROR</code> enabled, it proceeds to call all the
370
    registered appenders in this logger and also higher in the
371
    hierarchy depending on the value of the additivity flag.
372
373
    @param msg the message string to log.
374
375
    See also #LOG4CXX_ERROR.
376
    */
377
    void error(const CFStringRef& msg) const;
378
#endif
379
380
    /**
381
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>FATAL</code> events.
382
383
    <p>This method first checks if this logger is <code>FATAL</code>
384
    enabled by comparing the level of this logger with the
385
    FATAL level. If this logger is
386
    <code>FATAL</code> enabled, it proceeds to call all the
387
    registered appenders in this logger and also higher in the
388
    hierarchy depending on the value of the additivity flag.
389
390
    @param msg the message string to log.
391
    @param location The source code location of the logging request.
392
393
    See also #LOG4CXX_FATAL.
394
    */
395
    void fatal(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
396
    /**
397
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>FATAL</code> events.
398
399
    <p>This method first checks if this logger is <code>ERROR</code>
400
    enabled by comparing the level of this logger with the
401
    ERROR level. If this logger is
402
    <code>ERROR</code> enabled, it proceeds to call all the
403
    registered appenders in this logger and also higher in the
404
    hierarchy depending on the value of the additivity flag.
405
406
    @param msg the message string to log.
407
408
    See also #LOG4CXX_FATAL.
409
    */
410
    void fatal(const std::string& msg) const;
411
#if LOG4CXX_WCHAR_T_API
412
    /**
413
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>FATAL</code> events.
414
415
    <p>This method first checks if this logger is <code>ERROR</code>
416
    enabled by comparing the level of this logger with the
417
    ERROR level. If this logger is
418
    <code>ERROR</code> enabled, it proceeds to call all the
419
    registered appenders in this logger and also higher in the
420
    hierarchy depending on the value of the additivity flag.
421
422
    @param msg the message string to log.
423
    @param location The source code location of the logging request.
424
425
    See also #LOG4CXX_FATAL.
426
    */
427
    void fatal(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
428
    /**
429
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>FATAL</code> events.
430
431
    <p>This method first checks if this logger is <code>ERROR</code>
432
    enabled by comparing the level of this logger with the
433
    ERROR level. If this logger is
434
    <code>ERROR</code> enabled, it proceeds to call all the
435
    registered appenders in this logger and also higher in the
436
    hierarchy depending on the value of the additivity flag.
437
438
    @param msg the message string to log.
439
440
    See also #LOG4CXX_FATAL.
441
    */
442
    void fatal(const std::wstring& msg) const;
443
#endif
444
#if LOG4CXX_UNICHAR_API
445
    /**
446
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>FATAL</code> events.
447
448
    <p>This method first checks if this logger is <code>ERROR</code>
449
    enabled by comparing the level of this logger with the
450
    ERROR level. If this logger is
451
    <code>ERROR</code> enabled, it proceeds to call all the
452
    registered appenders in this logger and also higher in the
453
    hierarchy depending on the value of the additivity flag.
454
455
    @param msg the message string to log.
456
    @param location The source code location of the logging request.
457
458
    See also #LOG4CXX_FATAL.
459
    */
460
    void fatal(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
461
    /**
462
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>FATAL</code> events.
463
464
    <p>This method first checks if this logger is <code>ERROR</code>
465
    enabled by comparing the level of this logger with the
466
    ERROR level. If this logger is
467
    <code>ERROR</code> enabled, it proceeds to call all the
468
    registered appenders in this logger and also higher in the
469
    hierarchy depending on the value of the additivity flag.
470
471
    @param msg the message string to log.
472
473
    See also #LOG4CXX_FATAL.
474
    */
475
    void fatal(const std::basic_string<UniChar>& msg) const;
476
#endif
477
#if LOG4CXX_CFSTRING_API
478
    /**
479
    Add a new logging event containing \c msg and \c location to attached appender(s) if this logger is enabled for <code>FATAL</code> events.
480
481
    <p>This method first checks if this logger is <code>ERROR</code>
482
    enabled by comparing the level of this logger with the
483
    ERROR level. If this logger is
484
    <code>ERROR</code> enabled, it proceeds to call all the
485
    registered appenders in this logger and also higher in the
486
    hierarchy depending on the value of the additivity flag.
487
488
    @param msg the message string to log.
489
    @param location The source code location of the logging request.
490
491
    See also #LOG4CXX_FATAL.
492
    */
493
    void fatal(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
494
    /**
495
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>FATAL</code> events.
496
497
    <p>This method first checks if this logger is <code>ERROR</code>
498
    enabled by comparing the level of this logger with the
499
    ERROR level. If this logger is
500
    <code>ERROR</code> enabled, it proceeds to call all the
501
    registered appenders in this logger and also higher in the
502
    hierarchy depending on the value of the additivity flag.
503
504
    @param msg the message string to log.
505
506
    See also #LOG4CXX_FATAL.
507
    */
508
    void fatal(const CFStringRef& msg) const;
509
#endif
510
511
    /**
512
    Add a new logging event containing \c message and \c location to attached appender(s)
513
    without further checks.
514
    @param level The logging event level.
515
    @param message The text to add to the logging event.
516
    @param location The source code location of the logging request.
517
    */
518
    void addEvent(const LevelPtr& level, std::string&& message
519
      , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
520
521
    /**
522
    Add to attached appender(s) a new \c level LoggingEvent which was requested at \c sourceLocation where the message is built asynchronously by \c messageAppender
523
    without further checks.
524
    @param level The logging event level.
525
    @param message The text to add to the logging event.
526
    @param location The source code location of the logging request.
527
    */
528
    void addEvent(const LevelPtr& level, helpers::AsyncBuffer&& messageAppender
529
      , const spi::LocationInfo& sourceLocation = spi::LocationInfo::getLocationUnavailable()) const;
530
531
    /**
532
    Add a new fatal level logging event containing \c message and \c location to attached appender(s)
533
    without further checks.
534
    @param message The text to add to the logging event.
535
    @param location The source code location of the logging request.
536
    */
537
    void addFatalEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
538
539
    /**
540
    Add to attached appender(s) a new FATAL level LoggingEvent which was requested at \c sourceLocation where the message is built asynchronously by \c messageAppender
541
    without further checks.
542
    @param message The text to add to the logging event.
543
    @param location The source code location of the logging request.
544
    */
545
    void addFatalEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
546
547
    /**
548
    Add a new error level logging event containing \c message and \c location to attached appender(s)
549
    without further checks.
550
    @param message The text to add to the logging event.
551
    @param location The source code location of the logging request.
552
    */
553
    void addErrorEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
554
555
    /**
556
    Add to attached appender(s) a new ERROR level LoggingEvent which was requested at \c sourceLocation where the message is built asynchronously by \c messageAppender
557
    without further checks.
558
    @param message The text to add to the logging event.
559
    @param location The source code location of the logging request.
560
    */
561
    void addErrorEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
562
563
    /**
564
    Add a new warning level logging event containing \c message and \c location to attached appender(s)
565
    without further checks.
566
    @param message The text to add to the logging event.
567
    @param location The source code location of the logging request.
568
    */
569
    void addWarnEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
570
571
    /**
572
    Add to attached appender(s) a new WARN level LoggingEvent which was requested at \c sourceLocation where the message is built asynchronously by \c messageAppender
573
    without further checks.
574
    @param message The text to add to the logging event.
575
    @param location The source code location of the logging request.
576
    */
577
    void addWarnEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
578
579
    /**
580
    Add a new info level logging event containing \c message and \c location to attached appender(s)
581
    without further checks.
582
    @param message The text to add to the logging event.
583
    @param location The source code location of the logging request.
584
    */
585
    void addInfoEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
586
587
    /**
588
    Add to attached appender(s) a new INFO level LoggingEvent which was requested at \c sourceLocation where the message is built asynchronously by \c messageAppender
589
    without further checks.
590
    @param message The text to add to the logging event.
591
    @param location The source code location of the logging request.
592
    */
593
    void addInfoEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
594
595
    /**
596
    Add a new debug level logging event containing \c message and \c location to attached appender(s)
597
    without further checks.
598
    @param message The text to add to the logging event.
599
    @param location The source code location of the logging request.
600
    */
601
    void addDebugEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
602
603
    /**
604
    Add to attached appender(s) a new DEBUG level LoggingEvent which was requested at \c sourceLocation where the message is built asynchronously by \c messageAppender
605
    without further checks.
606
    @param message The text to add to the logging event.
607
    @param location The source code location of the logging request.
608
    */
609
    void addDebugEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
610
611
    /**
612
    Add a new trace level logging event containing \c message and \c location to attached appender(s)
613
    without further checks.
614
    @param message The text to add to the logging event.
615
    @param location The source code location of the logging request.
616
    */
617
    void addTraceEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
618
619
    /**
620
    Add to attached appender(s) a new TRACE level LoggingEvent which was requested at \c sourceLocation where the message is built asynchronously by \c messageAppender
621
    without further checks.
622
    @param message The text to add to the logging event.
623
    @param location The source code location of the logging request.
624
    */
625
    void addTraceEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
626
627
    /**
628
    Add a new logging event containing \c message and \c location to attached appender(s)
629
    without further checks.
630
    @param level The logging event level.
631
    @param message The text to add to the logging event.
632
    @param location The source code location of the logging request.
633
    */
634
    void forcedLog(const LevelPtr& level, const std::string& message,
635
      const LOG4CXX_NS::spi::LocationInfo& location) const;
636
    /**
637
    Add a new logging event containing \c message to attached appender(s)
638
    without further checks.
639
    @param level The logging event level.
640
    @param message The text to add to the logging event.
641
    */
642
    void forcedLog(const LevelPtr& level, const std::string& message) const;
643
644
#if LOG4CXX_WCHAR_T_API
645
    /**
646
    Add a new logging event containing \c message and \c location to attached appender(s)
647
    without further checks.
648
    @param level The logging event level.
649
    @param message The text to add to the logging event.
650
    @param location The source code location of the logging request.
651
    */
652
    void addEvent(const LevelPtr& level, std::wstring&& message
653
      , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
654
655
    /**
656
    Add a new fatal level logging event containing \c message and \c location to attached appender(s)
657
    without further checks.
658
    @param message The text to add to the logging event.
659
    @param location The source code location of the logging request.
660
    */
661
    void addFatalEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
662
663
    /**
664
    Add a new error level logging event containing \c message and \c location to attached appender(s)
665
    without further checks.
666
    @param message The text to add to the logging event.
667
    @param location The source code location of the logging request.
668
    */
669
    void addErrorEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
670
671
    /**
672
    Add a new warning level logging event containing \c message and \c location to attached appender(s)
673
    without further checks.
674
    @param message The text to add to the logging event.
675
    @param location The source code location of the logging request.
676
    */
677
    void addWarnEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
678
679
    /**
680
    Add a new info level logging event containing \c message and \c location to attached appender(s)
681
    without further checks.
682
    @param message The text to add to the logging event.
683
    @param location The source code location of the logging request.
684
    */
685
    void addInfoEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
686
687
    /**
688
    Add a new debug level logging event containing \c message and \c location to attached appender(s)
689
    without further checks.
690
    @param message The text to add to the logging event.
691
    @param location The source code location of the logging request.
692
    */
693
    void addDebugEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
694
695
    /**
696
    Add a new trace level logging event containing \c message and \c location to attached appender(s)
697
    without further checks.
698
    @param message The text to add to the logging event.
699
    @param location The source code location of the logging request.
700
    */
701
    void addTraceEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
702
703
    /**
704
    Add a new logging event containing \c message and \c location to attached appender(s)
705
    without further checks.
706
    @param level The logging event level.
707
    @param message The text to add to the logging event.
708
    @param location The source code location of the logging request.
709
    */
710
    void forcedLog(const LevelPtr& level, const std::wstring& message,
711
      const LOG4CXX_NS::spi::LocationInfo& location) const;
712
    /**
713
    Add a new logging event containing \c message to attached appender(s)
714
    without further checks.
715
    @param level The logging event level.
716
    @param message The text to add to the logging event.
717
    */
718
    void forcedLog(const LevelPtr& level, const std::wstring& message) const;
719
#endif
720
#if LOG4CXX_UNICHAR_API
721
    /**
722
    Add a new logging event containing \c message and \c location to attached appender(s)
723
    without further checks.
724
    @param level The logging event level.
725
    @param message The text to add to the logging event.
726
    @param location The source code location of the logging request.
727
    */
728
    void addEvent(const LevelPtr& level, std::basic_string<UniChar>&& message,
729
      const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
730
    /**
731
    Add a new fatal level logging event containing \c message and \c location to attached appender(s)
732
    without further checks.
733
    @param message The text to add to the logging event.
734
    @param location The source code location of the logging request.
735
    */
736
    void addFatalEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
737
    /**
738
    Add a new error level logging event containing \c message and \c location to attached appender(s)
739
    without further checks.
740
    @param message The text to add to the logging event.
741
    @param location The source code location of the logging request.
742
    */
743
    void addErrorEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
744
    /**
745
    Add a new warning level logging event containing \c message and \c location to attached appender(s)
746
    without further checks.
747
    @param message The text to add to the logging event.
748
    @param location The source code location of the logging request.
749
    */
750
    void addWarnEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
751
    /**
752
    Add a new info level logging event containing \c message and \c location to attached appender(s)
753
    without further checks.
754
    @param message The text to add to the logging event.
755
    @param location The source code location of the logging request.
756
    */
757
    void addInfoEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
758
    /**
759
    Add a new debug level logging event containing \c message and \c location to attached appender(s)
760
    without further checks.
761
    @param message The text to add to the logging event.
762
    @param location The source code location of the logging request.
763
    */
764
    void addDebugEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
765
    /**
766
    Add a new trace level logging event containing \c message and \c location to attached appender(s)
767
    without further checks.
768
    @param message The text to add to the logging event.
769
    @param location The source code location of the logging request.
770
    */
771
    void addTraceEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
772
773
    /**
774
    Add a new logging event containing \c message and \c location to attached appender(s)
775
    without further checks.
776
    @param level The logging event level.
777
    @param message The text to add to the logging event.
778
    @param location The source code location of the logging request.
779
    */
780
    void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message,
781
      const LOG4CXX_NS::spi::LocationInfo& location) const;
782
    /**
783
    Add a new logging event containing \c message to attached appender(s)
784
    without further checks.
785
    @param level The logging event level.
786
    @param message The text to add to the logging event.
787
    */
788
    void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
789
#endif
790
#if LOG4CXX_CFSTRING_API
791
    /**
792
    Add a new logging event containing \c message and \c location to attached appender(s)
793
    without further checks.
794
    @param level The logging event level.
795
    @param message The text to add to the logging event.
796
    @param location The source code location of the logging request.
797
    */
798
    void forcedLog(const LevelPtr& level, const CFStringRef& message,
799
      const LOG4CXX_NS::spi::LocationInfo& location) const;
800
    /**
801
    Add a new logging event containing \c message to attached appender(s)
802
    without further checks.
803
    @param level The logging event level.
804
    @param message The text to add to the logging event.
805
    */
806
    void forcedLog(const LevelPtr& level, const CFStringRef& message) const;
807
#endif
808
    /**
809
    Add a new logging event containing \c message and \c location to attached appender(s)
810
    without further checks.
811
    @param level The logging event level.
812
    @param message the message string to log.
813
    @param location location of the logging statement.
814
    */
815
    void addEventLS(const LevelPtr& level, LogString&& message
816
      , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
817
818
    /**
819
    Add a new logging event containing \c message and \c location to attached appender(s)
820
    without further checks.
821
    @param level The logging event level.
822
    @param message the message string to log.
823
    @param location location of the logging statement.
824
    */
825
    void forcedLogLS(const LevelPtr& level, const LogString& message,
826
      const LOG4CXX_NS::spi::LocationInfo& location) const;
827
828
    /**
829
    Get the additivity flag for this logger.
830
    */
831
    bool getAdditivity() const;
832
833
    /**
834
    Get the appenders contained in this logger as an AppenderList.
835
    If no appenders can be found, then an empty AppenderList
836
    is returned.
837
    @return AppenderList An collection of the appenders in this logger.*/
838
    AppenderList getAllAppenders() const override;
839
840
    /**
841
    Look for the appender named as <code>name</code>.
842
    <p>Return the appender with that name if in the list. Return
843
    <code>NULL</code> otherwise.  */
844
    AppenderPtr getAppender(const LogString& name) const override;
845
846
    /**
847
    Starting from this logger, search the logger hierarchy for a
848
    non-null level and return it.
849
850
    <p>The Logger class is designed so that this method executes as
851
    quickly as possible.
852
853
    @throws RuntimeException if all levels are null in the hierarchy
854
    */
855
    virtual const LevelPtr& getEffectiveLevel() const;
856
857
#if LOG4CXX_ABI_VERSION <= 15
858
    /**
859
    Return the the LoggerRepository where this
860
    <code>Logger</code> is attached.
861
    */
862
    spi::LoggerRepository* getLoggerRepository() const;
863
#endif
864
865
    /**
866
    * Get the logger name.
867
    * @return logger name as LogString.
868
    */
869
    const LogString& getName() const;
870
871
    /**
872
    * Put name of this logger into \c name in current encoding.
873
    * @param name buffer to which name is appended.
874
    */
875
    void getName(std::string& name) const;
876
#if LOG4CXX_WCHAR_T_API
877
    /**
878
    * Put name of this logger into \c name.
879
    * @param name buffer to which name is appended.
880
    */
881
    void getName(std::wstring& name) const;
882
#endif
883
#if LOG4CXX_UNICHAR_API
884
    /**
885
    * Put name of this logger into \c name.
886
    * @param name buffer to which name is appended.
887
    */
888
    void getName(std::basic_string<UniChar>& name) const;
889
#endif
890
#if LOG4CXX_CFSTRING_API
891
    /**
892
    * Put name of this logger into \c name.
893
    * @param name buffer to which name is appended.
894
    */
895
    void getName(CFStringRef& name) const;
896
#endif
897
898
    /**
899
    The parent of this logger. Note that the parent of a
900
    given logger may change during the lifetime of the logger.
901
902
    <p>The root logger will return <code>0</code>.
903
    */
904
    LoggerPtr getParent() const;
905
906
907
    /**
908
    The assigned Level, if any, for this logger.
909
910
    @return Level - the assigned Level, can be null.
911
    */
912
    const LevelPtr& getLevel() const;
913
914
#if 15 < LOG4CXX_ABI_VERSION
915
    /**
916
    The object that holds all Logger instances.
917
    */
918
    static spi::LoggerRepositoryPtr getLoggerRepository();
919
#endif
920
921
    /**
922
    * Retrieve a logger by name in current encoding.
923
    * @param name logger name.
924
    */
925
    static LoggerPtr getLogger(const std::string& name);
926
    /**
927
    * Retrieve a logger by name in current encoding.
928
    * @param name logger name.
929
    */
930
    static LoggerPtr getLogger(const char* const name);
931
#if LOG4CXX_WCHAR_T_API
932
    /**
933
    * Retrieve a logger by name.
934
    * @param name logger name.
935
    */
936
    static LoggerPtr getLogger(const std::wstring& name);
937
    /**
938
    * Retrieve a logger by name.
939
    * @param name logger name.
940
    */
941
    static LoggerPtr getLogger(const wchar_t* const name);
942
#endif
943
#if LOG4CXX_UNICHAR_API
944
    /**
945
    * Retrieve a logger by name.
946
    * @param name logger name.
947
    */
948
    static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
949
#endif
950
#if LOG4CXX_CFSTRING_API
951
    /**
952
    * Retrieve a logger by name.
953
    * @param name logger name.
954
    */
955
    static LoggerPtr getLogger(const CFStringRef& name);
956
#endif
957
    /**
958
    * Retrieve a logger by name in Unicode.
959
    * @param name logger name.
960
    */
961
    static LoggerPtr getLoggerLS(const LogString& name);
962
963
    /**
964
    Retrieve the root logger.
965
    */
966
    static LoggerPtr getRootLogger();
967
968
    /**
969
    Like #getLogger except that the type of logger
970
    instantiated depends on the type returned by the
971
    LoggerFactory#makeNewLoggerInstance method of the
972
    <code>factory</code> parameter.
973
974
    <p>This method is intended to be used by sub-classes.
975
976
    @param name The name of the logger to retrieve.
977
978
    @param factory A LoggerFactory implementation that will
979
    actually create a new Instance.
980
    */
981
    static LoggerPtr getLoggerLS(const LogString& name,
982
      const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
983
    /**
984
    Like #getLogger except that the type of logger
985
    instantiated depends on the type returned by the
986
    LoggerFactory#makeNewLoggerInstance method of the
987
    <code>factory</code> parameter.
988
989
    <p>This method is intended to be used by sub-classes.
990
991
    @param name The name of the logger to retrieve.
992
993
    @param factory A LoggerFactory implementation that will
994
    actually create a new Instance.
995
    */
996
    static LoggerPtr getLogger(const std::string& name,
997
      const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
998
#if LOG4CXX_WCHAR_T_API
999
    /**
1000
    Like #getLogger except that the type of logger
1001
    instantiated depends on the type returned by the
1002
    LoggerFactory#makeNewLoggerInstance method of the
1003
    <code>factory</code> parameter.
1004
1005
    <p>This method is intended to be used by sub-classes.
1006
1007
    @param name The name of the logger to retrieve.
1008
1009
    @param factory A LoggerFactory implementation that will
1010
    actually create a new Instance.
1011
    */
1012
    static LoggerPtr getLogger(const std::wstring& name,
1013
      const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
1014
#endif
1015
#if LOG4CXX_UNICHAR_API
1016
    /**
1017
    Like #getLogger except that the type of logger
1018
    instantiated depends on the type returned by the
1019
    LoggerFactory#makeNewLoggerInstance method of the
1020
    <code>factory</code> parameter.
1021
1022
    <p>This method is intended to be used by sub-classes.
1023
1024
    @param name The name of the logger to retrieve.
1025
1026
    @param factory A LoggerFactory implementation that will
1027
    actually create a new Instance.
1028
    */
1029
    static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
1030
      const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
1031
#endif
1032
#if LOG4CXX_CFSTRING_API
1033
    /**
1034
    Like #getLogger except that the type of logger
1035
    instantiated depends on the type returned by the
1036
    LoggerFactory#makeNewLoggerInstance method of the
1037
    <code>factory</code> parameter.
1038
1039
    <p>This method is intended to be used by sub-classes.
1040
1041
    @param name The name of the logger to retrieve.
1042
1043
    @param factory A LoggerFactory implementation that will
1044
    actually create a new Instance.
1045
    */
1046
    static LoggerPtr getLogger(const CFStringRef& name,
1047
      const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
1048
#endif
1049
1050
    /**
1051
    Return the <em>inherited</em> ResourceBundle for this logger.
1052
1053
1054
    This method walks the hierarchy to find the appropriate resource bundle.
1055
    It will return the resource bundle attached to the closest ancestor of
1056
    this logger, much like the way priorities are searched. In case there
1057
    is no bundle in the hierarchy then <code>NULL</code> is returned.
1058
    */
1059
    helpers::ResourceBundlePtr getResourceBundle() const;
1060
1061
  protected:
1062
    /**
1063
    Returns the string resource corresponding to <code>key</code> in this
1064
    logger's inherited resource bundle.
1065
1066
    If the resource cannot be found, then an {@link #error error} message
1067
    will be logged complaining about the missing resource.
1068
1069
    @see #getResourceBundle.
1070
    */
1071
    LogString getResourceBundleString(const LogString& key) const;
1072
1073
  public:
1074
    /**
1075
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
1076
1077
    <p>This method first checks if this logger is <code>INFO</code>
1078
    enabled by comparing the level of this logger with the
1079
    INFO level. If this logger is
1080
    <code>INFO</code> enabled, it proceeds to call all the
1081
    registered appenders in this logger and also higher in the
1082
    hierarchy depending on the value of the additivity flag.
1083
1084
    @param msg the message string to log.
1085
    @param location The source code location of the logging request.
1086
1087
    See also #LOG4CXX_INFO.
1088
    */
1089
    void info(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1090
    /**
1091
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
1092
1093
    <p>This method first checks if this logger is <code>INFO</code>
1094
    enabled by comparing the level of this logger with the
1095
    INFO level. If this logger is
1096
    <code>INFO</code> enabled, it proceeds to call all the
1097
    registered appenders in this logger and also higher in the
1098
    hierarchy depending on the value of the additivity flag.
1099
1100
    @param msg the message string to log.
1101
1102
    See also #LOG4CXX_INFO.
1103
    */
1104
    void info(const std::string& msg) const;
1105
#if LOG4CXX_WCHAR_T_API
1106
    /**
1107
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
1108
1109
    <p>This method first checks if this logger is <code>INFO</code>
1110
    enabled by comparing the level of this logger with the
1111
    INFO level. If this logger is
1112
    <code>INFO</code> enabled, it proceeds to call all the
1113
    registered appenders in this logger and also higher in the
1114
    hierarchy depending on the value of the additivity flag.
1115
1116
    @param msg the message string to log.
1117
    @param location The source code location of the logging request.
1118
1119
    See also #LOG4CXX_INFO.
1120
    */
1121
    void info(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1122
    /**
1123
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
1124
1125
    <p>This method first checks if this logger is <code>INFO</code>
1126
    enabled by comparing the level of this logger with the
1127
    INFO level. If this logger is
1128
    <code>INFO</code> enabled, it proceeds to call all the
1129
    registered appenders in this logger and also higher in the
1130
    hierarchy depending on the value of the additivity flag.
1131
1132
    @param msg the message string to log.
1133
1134
    See also #LOG4CXX_INFO.
1135
    */
1136
    void info(const std::wstring& msg) const;
1137
#endif
1138
#if LOG4CXX_UNICHAR_API
1139
    /**
1140
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
1141
1142
    <p>This method first checks if this logger is <code>INFO</code>
1143
    enabled by comparing the level of this logger with the
1144
    INFO level. If this logger is
1145
    <code>INFO</code> enabled, it proceeds to call all the
1146
    registered appenders in this logger and also higher in the
1147
    hierarchy depending on the value of the additivity flag.
1148
1149
    @param msg the message string to log.
1150
    @param location The source code location of the logging request.
1151
            */
1152
    void info(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1153
    /**
1154
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
1155
1156
    <p>This method first checks if this logger is <code>INFO</code>
1157
    enabled by comparing the level of this logger with the
1158
    INFO level. If this logger is
1159
    <code>INFO</code> enabled, it proceeds to call all the
1160
    registered appenders in this logger and also higher in the
1161
    hierarchy depending on the value of the additivity flag.
1162
1163
    @param msg the message string to log.
1164
1165
    See also #LOG4CXX_INFO.
1166
    */
1167
    void info(const std::basic_string<UniChar>& msg) const;
1168
#endif
1169
#if LOG4CXX_CFSTRING_API
1170
    /**
1171
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
1172
1173
    <p>This method first checks if this logger is <code>INFO</code>
1174
    enabled by comparing the level of this logger with the
1175
    INFO level. If this logger is
1176
    <code>INFO</code> enabled, it proceeds to call all the
1177
    registered appenders in this logger and also higher in the
1178
    hierarchy depending on the value of the additivity flag.
1179
1180
    @param msg the message string to log.
1181
    @param location The source code location of the logging request.
1182
1183
    See also #LOG4CXX_INFO.
1184
    */
1185
    void info(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1186
    /**
1187
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
1188
1189
    <p>This method first checks if this logger is <code>INFO</code>
1190
    enabled by comparing the level of this logger with the
1191
    INFO level. If this logger is
1192
    <code>INFO</code> enabled, it proceeds to call all the
1193
    registered appenders in this logger and also higher in the
1194
    hierarchy depending on the value of the additivity flag.
1195
1196
    @param msg the message string to log.
1197
1198
    See also #LOG4CXX_INFO.
1199
    */
1200
    void info(const CFStringRef& msg) const;
1201
#endif
1202
1203
    /**
1204
    Is \c appender attached to this logger?
1205
    */
1206
    bool isAttached(const AppenderPtr appender) const override;
1207
1208
    /**
1209
     *  Is this logger is enabled for <code>DEBUG</code> level logging events?
1210
     *
1211
     *  <p>By writing
1212
     *  ~~~{.cpp}
1213
     *  if(logger->isDebugEnabled()) {
1214
     *      logger->debug("Component: " + std::to_string(componentNumber));
1215
     *    }
1216
     *  ~~~
1217
     *  you will not incur the cost of parameter construction
1218
     *  (integer to string conversion plus string concatonation in this case)
1219
     *  if debugging is disabled for <code>logger</code>.
1220
     *  You avoid the cost constructing the message
1221
     *  when the message is not logged.
1222
     *
1223
     *  <p>This function allows you to reduce the computational cost of
1224
     *  disabled log debug statements compared to writing:
1225
     *  ~~~{.cpp}
1226
     *      logger->debug("Component: " + std::to_string(componentNumber));
1227
     *  ~~~
1228
     *
1229
     *  <p>On the other hand, if the <code>logger</code> is enabled for <code>DEBUG</code> logging events,
1230
     *  you will incur the cost of evaluating whether the logger is
1231
     *  enabled twice, once in <code>isDebugEnabled</code> and once in
1232
     *  the <code>DEBUG</code>.  This really is an insignificant overhead
1233
     *  since evaluating a the enabled status takes about 1% of the time it
1234
     *  takes to send the message to the appender.
1235
1236
     * See also #isDebugEnabledFor.
1237
     * See also #LOG4CXX_DEBUG.
1238
     *
1239
     *  @return bool - <code>true</code> if this logger is debug
1240
     *  enabled, <code>false</code> otherwise.
1241
     **/
1242
    bool isDebugEnabled() const;
1243
1244
    /**
1245
     *  Is \c logger is enabled for <code>DEBUG</code> level logging events?
1246
     *
1247
     *  <p>By writing
1248
     *  ~~~{.cpp}
1249
     *    if(log4cxx::Logger::isDebugEnabledFor(logger)) {
1250
     *      logger->addDebugEvent("Component: " + std::to_string(componentNumber));
1251
     *    }
1252
     *  ~~~
1253
     *  you minimise the computational cost
1254
     *  when \c logger is not enabled for <code>DEBUG</code> logging events.
1255
     *  This function may be inlined thereby avoiding a function call
1256
     *  as well as the cost constructing the message
1257
     *  when \c logger is not enabled for <code>DEBUG</code> events.
1258
     *
1259
     * See also #LOG4CXX_DEBUG.
1260
     *
1261
     *  @return bool - <code>false</code> if \c logger is <code>null</code>
1262
     *  or <code>DEBUG</code> logging events are disabled for \c logger,
1263
     *  <code>true</code> otherwise.
1264
     **/
1265
    inline static bool isDebugEnabledFor(const LoggerPtr& logger)
1266
0
    {
1267
0
      return logger && logger->m_threshold <= Level::DEBUG_INT && logger->isDebugEnabled();
1268
0
    }
1269
1270
    /**
1271
    Is this logger is enabled for logging events at \c level?
1272
1273
    @return bool True if this logger is enabled for <code>level</code> logging events.
1274
    */
1275
    bool isEnabledFor(const LevelPtr& level) const;
1276
1277
1278
    /**
1279
    Is this logger is enabled for <code>INFO</code> level logging events?
1280
1281
    See #isDebugEnabled.
1282
    See also #LOG4CXX_INFO.
1283
1284
    @return bool - <code>true</code> if this logger is enabled
1285
    for level info, <code>false</code> otherwise.
1286
    */
1287
    bool isInfoEnabled() const;
1288
1289
    /**
1290
    Is \c logger is enabled for <code>INFO</code> level logging events?
1291
1292
    See #isDebugEnabledFor.
1293
    See also #LOG4CXX_INFO.
1294
1295
    @return bool - <code>false</code> if \c logger is <code>null</code>
1296
    or <code>INFO</code> logging events are disabled for \c logger,
1297
    <code>true</code> otherwise.
1298
    */
1299
    inline static bool isInfoEnabledFor(const LoggerPtr& logger)
1300
44.7k
    {
1301
44.7k
      return logger && logger->m_threshold <= Level::INFO_INT && logger->isInfoEnabled();
1302
44.7k
    }
1303
1304
    /**
1305
    Is this logger is enabled for <code>WARN</code> level logging events?
1306
1307
    See also #isDebugEnabled.
1308
    See also #LOG4CXX_WARN.
1309
1310
    @return bool - <code>true</code> if this logger is enabled
1311
    for level warn, <code>false</code> otherwise.
1312
    */
1313
    bool isWarnEnabled() const;
1314
1315
    /**
1316
    Is \c logger is enabled for <code>WARN</code> level logging events?
1317
1318
    See #isDebugEnabledFor.
1319
    See also #LOG4CXX_WARN.
1320
1321
    @return bool - <code>false</code> if \c logger is <code>null</code>
1322
    or <code>WARN</code> logging events are disabled for \c logger,
1323
    <code>true</code> otherwise.
1324
    */
1325
    inline static bool isWarnEnabledFor(const LoggerPtr& logger)
1326
0
    {
1327
0
      return logger && logger->m_threshold <= Level::WARN_INT && logger->isWarnEnabled();
1328
0
    }
1329
1330
    /**
1331
    Is this logger is enabled for <code>ERROR</code> level logging events?
1332
1333
    See also #isDebugEnabled.
1334
    See also #LOG4CXX_ERROR.
1335
1336
    @return bool - <code>true</code> if this logger is enabled
1337
    for level error, <code>false</code> otherwise.
1338
    */
1339
    bool isErrorEnabled() const;
1340
1341
    /**
1342
    Is \c logger is enabled for <code>ERROR</code> level logging events?
1343
1344
    See #isDebugEnabledFor.
1345
    See also #LOG4CXX_ERROR.
1346
1347
    @return bool - <code>false</code> if \c logger is <code>null</code>
1348
    or <code>ERROR</code> logging events are disabled for \c logger,
1349
    <code>true</code> otherwise.
1350
    */
1351
    inline static bool isErrorEnabledFor(const LoggerPtr& logger)
1352
0
    {
1353
0
      return logger && logger->m_threshold <= Level::ERROR_INT && logger->isErrorEnabled();
1354
0
    }
1355
1356
    /**
1357
    Is this logger is enabled for <code>FATAL</code> level logging events?
1358
1359
    See also #isDebugEnabled.
1360
    See also #LOG4CXX_FATAL.
1361
1362
    @return bool - <code>true</code> if this logger is enabled
1363
    for level fatal, <code>false</code> otherwise.
1364
    */
1365
    bool isFatalEnabled() const;
1366
1367
    /**
1368
    Is \c logger is enabled for <code>FATAL</code> level logging events?
1369
1370
    See #isDebugEnabledFor.
1371
    See also #LOG4CXX_FATAL.
1372
1373
    @return bool - <code>false</code> if \c logger is <code>null</code>
1374
    or <code>FATAL</code> logging events are disabled for \c logger,
1375
    <code>true</code> otherwise.
1376
    */
1377
    inline static bool isFatalEnabledFor(const LoggerPtr& logger)
1378
0
    {
1379
0
      return logger && logger->m_threshold <= Level::FATAL_INT && logger->isFatalEnabled();
1380
0
    }
1381
1382
    /**
1383
    Is this logger is enabled for <code>TRACE</code> level logging events?
1384
1385
    See also #isDebugEnabled.
1386
    See also #LOG4CXX_FATAL.
1387
1388
    @return bool - <code>true</code> if this logger is enabled
1389
    for level trace, <code>false</code> otherwise.
1390
    */
1391
    bool isTraceEnabled() const;
1392
1393
    /**
1394
    Is \c logger is enabled for <code>TRACE</code> level logging events?
1395
1396
    See #isDebugEnabledFor.
1397
    See also #LOG4CXX_TRACE.
1398
1399
    @return bool - <code>false</code> if \c logger is <code>null</code>
1400
    or <code>TRACE</code> logging events are disabled for \c logger,
1401
    <code>true</code> otherwise.
1402
    */
1403
    inline static bool isTraceEnabledFor(const LoggerPtr& logger)
1404
0
    {
1405
0
      return logger && logger->m_threshold <= Level::TRACE_INT && logger->isTraceEnabled();
1406
0
    }
1407
1408
    /**
1409
    Add a new logging event containing \c locationInfo and the localized message \c key using \c values for parameter substitution
1410
    to attached appender(s) if this logger is enabled for \c level events.
1411
1412
    First, the user supplied
1413
    <code>key</code> is searched in the resource bundle. Next, the resulting
1414
    pattern is formatted using helpers::StringHelper::format method.
1415
1416
    @param level The level of the logging request.
1417
    @param key The key to be searched in the ResourceBundle.
1418
    @param locationInfo The location info of the logging request.
1419
    @param values The values for the placeholders <code>{0}</code>,
1420
                  <code>{1}</code> etc. within the pattern.
1421
1422
    @see #setResourceBundle
1423
1424
    See also #LOG4CXX_L7DLOG1.
1425
    */
1426
    void l7dlog(const LevelPtr& level, const LogString& key,
1427
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1428
      const std::vector<LogString>& values) const;
1429
    /**
1430
    Add a new logging event containing \c locationInfo and the localized message \c key to attached appender(s) if this logger is enabled for \c level events.
1431
1432
    First, the user supplied
1433
    <code>key</code> is searched in the resource bundle. Next, the resulting
1434
    pattern is formatted using helpers::StringHelper::format method.
1435
1436
    @param level The level of the logging request.
1437
    @param key The key to be searched in the ResourceBundle.
1438
    @param locationInfo The location info of the logging request.
1439
1440
    @see #setResourceBundle
1441
1442
    See also #LOG4CXX_L7DLOG.
1443
    */
1444
    void l7dlog(const LevelPtr& level, const std::string& key,
1445
      const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1446
    /**
1447
    Add a new logging event containing \c locationInfo and the localized message \c key using parameter \c val to attached appender(s) if this logger is enabled for \c level events.
1448
1449
    First, the user supplied
1450
    <code>key</code> is searched in the resource bundle. Next, the resulting
1451
    pattern is formatted using helpers::StringHelper::format method with the
1452
    supplied parameters in a string array.
1453
1454
    @param level The level of the logging request.
1455
    @param key The key to be searched in the ResourceBundle.
1456
    @param locationInfo The location info of the logging request.
1457
    @param val The first value for the placeholders within the pattern.
1458
1459
    @see #setResourceBundle
1460
1461
    See also #LOG4CXX_L7DLOG1.
1462
    */
1463
    void l7dlog(const LevelPtr& level, const std::string& key,
1464
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1465
      const std::string& val) const;
1466
    /**
1467
    Add a new logging event containing \c locationInfo and the localized message \c key using parameters \c val1 and \c val2 to attached appender(s) if this logger is enabled for \c level events.
1468
1469
    First, the user supplied
1470
    <code>key</code> is searched in the resource bundle. Next, the resulting
1471
    pattern is formatted using helpers::StringHelper::format method with the
1472
    supplied parameters in a string array.
1473
1474
    @param level The level of the logging request.
1475
    @param key The key to be searched in the ResourceBundle.
1476
    @param locationInfo The location info of the logging request.
1477
    @param val1 The first value for the placeholders within the pattern.
1478
    @param val2 The second value for the placeholders within the pattern.
1479
1480
    @see #setResourceBundle
1481
1482
    See also #LOG4CXX_L7DLOG2.
1483
    */
1484
    void l7dlog(const LevelPtr& level, const std::string& key,
1485
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1486
      const std::string& val1, const std::string& val2) const;
1487
    /**
1488
    Add a new logging event containing \c locationInfo and the localized message \c key using parameters \c val1, \c val2 and \c val3 to attached appender(s) if this logger is enabled for \c level events.
1489
1490
    First, the user supplied
1491
    <code>key</code> is searched in the resource bundle. Next, the resulting
1492
    pattern is formatted using helpers::StringHelper::format method with the
1493
    supplied parameters in a string array.
1494
1495
    @param level The level of the logging request.
1496
    @param key The key to be searched in the ResourceBundle.
1497
    @param locationInfo The location info of the logging request.
1498
    @param val1 The value for the first placeholder within the pattern.
1499
    @param val2 The value for the second placeholder within the pattern.
1500
    @param val3 The value for the third placeholder within the pattern.
1501
1502
    @see #setResourceBundle
1503
1504
    See also #LOG4CXX_L7DLOG3.
1505
    */
1506
    void l7dlog(const LevelPtr& level, const std::string& key,
1507
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1508
      const std::string& val1, const std::string& val2, const std::string& val3) const;
1509
1510
#if LOG4CXX_WCHAR_T_API
1511
    /**
1512
    Add a new logging event containing \c locationInfo and the localized message \c key to attached appender(s) if this logger is enabled for \c level events.
1513
1514
    First, the user supplied
1515
    <code>key</code> is searched in the resource bundle. Next, the resulting
1516
    pattern is formatted using helpers::StringHelper::format method .
1517
1518
    @param level The level of the logging request.
1519
    @param key The key to be searched in the ResourceBundle.
1520
    @param locationInfo The location info of the logging request.
1521
1522
    @see #setResourceBundle
1523
1524
    See also #LOG4CXX_L7DLOG.
1525
    */
1526
    void l7dlog(const LevelPtr& level, const std::wstring& key,
1527
      const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1528
    /**
1529
    Add a new logging event containing \c locationInfo and the localized message \c key using parameter \c val to attached appender(s) if this logger is enabled for \c level events.
1530
1531
    First, the user supplied
1532
    <code>key</code> is searched in the resource bundle. Next, the resulting
1533
    pattern is formatted using helpers::StringHelper::format method with the
1534
    supplied parameter in a string array.
1535
1536
    @param level The level of the logging request.
1537
    @param key The key to be searched in the ResourceBundle.
1538
    @param locationInfo The location info of the logging request.
1539
    @param val The value for the first placeholder within the pattern.
1540
1541
    @see #setResourceBundle
1542
1543
    See also #LOG4CXX_L7DLOG1.
1544
    */
1545
    void l7dlog(const LevelPtr& level, const std::wstring& key,
1546
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1547
      const std::wstring& val) const;
1548
    /**
1549
    Add a new logging event containing \c locationInfo and the localized message \c key using parameters \c val1 and \c val2 to attached appender(s) if this logger is enabled for \c level events.
1550
1551
    First, the user supplied
1552
    <code>key</code> is searched in the resource bundle. Next, the resulting
1553
    pattern is formatted using helpers::StringHelper::format method with the
1554
    supplied parameters in a string array.
1555
1556
    @param level The level of the logging request.
1557
    @param key The key to be searched in the ResourceBundle.
1558
    @param locationInfo The location info of the logging request.
1559
    @param val1 The value for the first placeholder within the pattern.
1560
    @param val2 The value for the second placeholder within the pattern.
1561
1562
    @see #setResourceBundle
1563
1564
    See also #LOG4CXX_L7DLOG2.
1565
    */
1566
    void l7dlog(const LevelPtr& level, const std::wstring& key,
1567
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1568
      const std::wstring& val1, const std::wstring& val2) const;
1569
    /**
1570
    Add a new logging event containing \c locationInfo and the localized message \c key using parameters \c val1, \c val2 and \c val3 to attached appender(s) if this logger is enabled for \c level events.
1571
1572
    First, the user supplied
1573
    <code>key</code> is searched in the resource bundle. Next, the resulting
1574
    pattern is formatted using helpers::StringHelper::format method with the
1575
    supplied parameters in a string array.
1576
1577
    @param level The level of the logging request.
1578
    @param key The key to be searched in the ResourceBundle.
1579
    @param locationInfo The location info of the logging request.
1580
    @param val1 The value for the first placeholder within the pattern.
1581
    @param val2 The value for the second placeholder within the pattern.
1582
    @param val3 The value for the third placeholder within the pattern.
1583
1584
    @see #setResourceBundle
1585
1586
    See also #LOG4CXX_L7DLOG3.
1587
    */
1588
    void l7dlog(const LevelPtr& level, const std::wstring& key,
1589
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1590
      const std::wstring& val1, const std::wstring& val2, const std::wstring& val3) const;
1591
#endif
1592
#if LOG4CXX_UNICHAR_API
1593
    /**
1594
    Add a new logging event containing \c locationInfo and the localized message \c key to attached appender(s) if this logger is enabled for \c level events.
1595
1596
    First, the user supplied
1597
    <code>key</code> is searched in the resource bundle. Next, the resulting
1598
    pattern is formatted using helpers::StringHelper::format method.
1599
1600
    @param level The level of the logging request.
1601
    @param key The key to be searched in the ResourceBundle.
1602
    @param locationInfo The location info of the logging request.
1603
1604
    @see #setResourceBundle
1605
1606
    See also #LOG4CXX_L7DLOG.
1607
    */
1608
    void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1609
      const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1610
    /**
1611
    Add a new logging event containing \c locationInfo and the localized message \c key using parameter \c val to attached appender(s) if this logger is enabled for \c level events.
1612
1613
    First, the user supplied
1614
    <code>key</code> is searched in the resource bundle. Next, the resulting
1615
    pattern is formatted using helpers::StringHelper::format method with the
1616
    supplied parameter in a string array.
1617
1618
    @param level The level of the logging request.
1619
    @param key The key to be searched in the ResourceBundle.
1620
    @param locationInfo The location info of the logging request.
1621
    @param val The value for the first placeholder within the pattern.
1622
1623
    @see #setResourceBundle
1624
1625
    See also #LOG4CXX_L7DLOG1.
1626
    */
1627
    void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1628
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1629
      const std::basic_string<UniChar>& val) const;
1630
    /**
1631
    Add a new logging event containing \c locationInfo and the localized message \c key using parameters \c val1 and \c val2 to attached appender(s) if this logger is enabled for \c level events.
1632
1633
    First, the user supplied
1634
    <code>key</code> is searched in the resource bundle. Next, the resulting
1635
    pattern is formatted using helpers::StringHelper::format method with the
1636
    supplied parameters in a string array.
1637
1638
    @param level The level of the logging request.
1639
    @param key The key to be searched in the ResourceBundle.
1640
    @param locationInfo The location info of the logging request.
1641
    @param val1 The value for the first placeholder within the pattern.
1642
    @param val2 The value for the second placeholder within the pattern.
1643
1644
    @see #setResourceBundle
1645
1646
    See also #LOG4CXX_L7DLOG2.
1647
    */
1648
    void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1649
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1650
      const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2) const;
1651
    /**
1652
    Add a new logging event containing \c locationInfo and the localized message \c key using parameters \c val1, \c val2 and \c val3 to attached appender(s) if this logger is enabled for \c level events.
1653
1654
    First, the user supplied
1655
    <code>key</code> is searched in the resource bundle. Next, the resulting
1656
    pattern is formatted using helpers::StringHelper::format method with the
1657
    supplied parameters in a string array.
1658
1659
    @param level The level of the logging request.
1660
    @param key The key to be searched in the ResourceBundle.
1661
    @param locationInfo The location info of the logging request.
1662
    @param val1 The value for the first placeholder within the pattern.
1663
    @param val2 The value for the second placeholder within the pattern.
1664
    @param val3 The value for the third placeholder within the pattern.
1665
1666
    @see #setResourceBundle
1667
1668
    See also #LOG4CXX_L7DLOG3.
1669
    */
1670
    void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1671
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1672
      const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2,
1673
      const std::basic_string<UniChar>& val3) const;
1674
#endif
1675
#if LOG4CXX_CFSTRING_API
1676
    /**
1677
    Add a new logging event containing \c locationInfo and the localized message \c key to attached appender(s) if this logger is enabled for \c level events.
1678
1679
    First, the user supplied
1680
    <code>key</code> is searched in the resource bundle. Next, the resulting
1681
    pattern is formatted using helpers::StringHelper::format method.
1682
1683
    @param level The level of the logging request.
1684
    @param key The key to be searched in the ResourceBundle.
1685
    @param locationInfo The location info of the logging request.
1686
1687
    @see #setResourceBundle
1688
1689
    See also #LOG4CXX_L7DLOG.
1690
    */
1691
    void l7dlog(const LevelPtr& level, const CFStringRef& key,
1692
      const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1693
    /**
1694
    Add a new logging event containing \c locationInfo and the localized message \c key using parameter \c val to attached appender(s) if this logger is enabled for \c level events.
1695
1696
    First, the user supplied
1697
    <code>key</code> is searched in the resource bundle. Next, the resulting
1698
    pattern is formatted using helpers::StringHelper::format method with the
1699
    supplied parameter in a string array.
1700
1701
    @param level The level of the logging request.
1702
    @param key The key to be searched in the ResourceBundle.
1703
    @param locationInfo The location info of the logging request.
1704
    @param val1 The value for the first placeholder within the pattern.
1705
1706
    @see #setResourceBundle
1707
1708
    See also #LOG4CXX_L7DLOG1.
1709
    */
1710
    void l7dlog(const LevelPtr& level, const CFStringRef& key,
1711
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1712
      const CFStringRef& val1) const;
1713
    /**
1714
    Add a new logging event containing \c locationInfo and the localized message \c key using parameters \c val1 and \c val2 to attached appender(s) if this logger is enabled for \c level events.
1715
1716
    First, the user supplied
1717
    <code>key</code> is searched in the resource bundle. Next, the resulting
1718
    pattern is formatted using helpers::StringHelper::format method with the
1719
    supplied parameters in a string array.
1720
1721
    @param level The level of the logging request.
1722
    @param key The key to be searched in the ResourceBundle.
1723
    @param locationInfo The location info of the logging request.
1724
    @param val1 The value for the first placeholder within the pattern.
1725
    @param val2 The value for the second placeholder within the pattern.
1726
1727
    @see #setResourceBundle
1728
1729
    See also #LOG4CXX_L7DLOG2.
1730
    */
1731
    void l7dlog(const LevelPtr& level, const CFStringRef& key,
1732
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1733
      const CFStringRef& val1, const CFStringRef& val2) const;
1734
    /**
1735
    Add a new logging event containing \c locationInfo and the localized message \c key using parameters \c val1, \c val2 and \c val3 to attached appender(s) if this logger is enabled for \c level events.
1736
1737
    First, the user supplied
1738
    <code>key</code> is searched in the resource bundle. Next, the resulting
1739
    pattern is formatted using helpers::StringHelper::format method with the
1740
    supplied parameters in a string array.
1741
1742
    @param level The level of the logging request.
1743
    @param key The key to be searched in the ResourceBundle.
1744
    @param locationInfo The location info of the logging request.
1745
    @param val1 The value for the first placeholder within the pattern.
1746
    @param val2 The value for the second placeholder within the pattern.
1747
    @param val3 The value for the third placeholder within the pattern.
1748
1749
    @see #setResourceBundle
1750
1751
    See also #LOG4CXX_L7DLOG3.
1752
    */
1753
    void l7dlog(const LevelPtr& level, const CFStringRef& key,
1754
      const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1755
      const CFStringRef& val1, const CFStringRef& val2,
1756
      const CFStringRef& val3) const;
1757
#endif
1758
1759
    /**
1760
    Add a new logging event containing \c message and \c location to the appenders attached to this logger if this logger is enabled for \c level events.
1761
    This is the most generic printing method. It is intended to be
1762
    invoked by <b>wrapper</b> classes.
1763
1764
    @param level The level of the logging request.
1765
    @param message The message of the logging request.
1766
    @param location The source file of the logging request, may be null. */
1767
    void log(const LevelPtr& level, const std::string& message,
1768
      const LOG4CXX_NS::spi::LocationInfo& location) const;
1769
    /**
1770
    Add a new logging event containing \c message to the appenders attached to this logger if this logger is enabled for \c level events.
1771
    This is the most generic printing method. It is intended to be
1772
    invoked by <b>wrapper</b> classes.
1773
1774
    @param level The level of the logging request.
1775
    @param message The message of the logging request.
1776
    */
1777
    void log(const LevelPtr& level, const std::string& message) const;
1778
#if LOG4CXX_WCHAR_T_API
1779
    /**
1780
    Add a new logging event containing \c message and \c location to the appenders attached to this logger if this logger is enabled for \c level events.
1781
    This is the most generic printing method. It is intended to be
1782
    invoked by <b>wrapper</b> classes.
1783
1784
    @param level The level of the logging request.
1785
    @param message The message of the logging request.
1786
    @param location The source file of the logging request, may be null. */
1787
    void log(const LevelPtr& level, const std::wstring& message,
1788
      const LOG4CXX_NS::spi::LocationInfo& location) const;
1789
    /**
1790
    Add a new logging event containing \c message to the appenders attached to this logger if this logger is enabled for \c level events.
1791
    This is the most generic printing method. It is intended to be
1792
    invoked by <b>wrapper</b> classes.
1793
1794
    @param level The level of the logging request.
1795
    @param message The message of the logging request.
1796
    */
1797
    void log(const LevelPtr& level, const std::wstring& message) const;
1798
#endif
1799
#if LOG4CXX_UNICHAR_API
1800
    /**
1801
    Add a new logging event containing \c message and \c location to the appenders attached to this logger if this logger is enabled for \c level events.
1802
    This is the most generic printing method. It is intended to be
1803
    invoked by <b>wrapper</b> classes.
1804
1805
    @param level The level of the logging request.
1806
    @param message The message of the logging request.
1807
    @param location The source file of the logging request, may be null. */
1808
    void log(const LevelPtr& level, const std::basic_string<UniChar>& message,
1809
      const LOG4CXX_NS::spi::LocationInfo& location) const;
1810
    /**
1811
    Add a new logging event containing \c message to the appenders attached to this logger if this logger is enabled for \c level events.
1812
    This is the most generic printing method. It is intended to be
1813
    invoked by <b>wrapper</b> classes.
1814
1815
    @param level The level of the logging request.
1816
    @param message The message of the logging request.
1817
    */
1818
    void log(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
1819
#endif
1820
#if LOG4CXX_CFSTRING_API
1821
    /**
1822
    Add a new logging event containing \c message and \c location to the appenders attached to this logger if this logger is enabled for \c level events.
1823
    This is the most generic printing method. It is intended to be
1824
    invoked by <b>wrapper</b> classes.
1825
1826
    @param level The level of the logging request.
1827
    @param message The message of the logging request.
1828
    @param location The source file of the logging request, may be null. */
1829
    void log(const LevelPtr& level, const CFStringRef& message,
1830
      const LOG4CXX_NS::spi::LocationInfo& location) const;
1831
    /**
1832
    Add a new logging event containing \c message to the appenders attached to this logger if this logger is enabled for \c level events.
1833
    This is the most generic printing method. It is intended to be
1834
    invoked by <b>wrapper</b> classes.
1835
1836
    @param level The level of the logging request.
1837
    @param message The message of the logging request.
1838
    */
1839
    void log(const LevelPtr& level, const CFStringRef& message) const;
1840
#endif
1841
    /**
1842
    Add a new logging event containing \c message and \c location to the appenders attached to this logger if this logger is enabled for \c level events.
1843
    This is the most generic printing method. It is intended to be
1844
    invoked by <b>wrapper</b> classes.
1845
1846
    @param level The level of the logging request.
1847
    @param message The message of the logging request.
1848
    @param location The source file of the logging request, may be null. */
1849
    void logLS(const LevelPtr& level, const LogString& message,
1850
      const LOG4CXX_NS::spi::LocationInfo& location) const;
1851
1852
1853
1854
    /**
1855
    Remove all previously added appenders from this logger
1856
    instance.
1857
    <p>This is useful when re-reading configuration information.
1858
    */
1859
    void removeAllAppenders() override;
1860
1861
    /**
1862
    Remove the appender passed as parameter form the list of appenders.
1863
    */
1864
    void removeAppender(const AppenderPtr appender) override;
1865
1866
    /**
1867
    Remove the appender with the name passed as parameter form the
1868
    list of appenders.
1869
     */
1870
    void removeAppender(const LogString& name) override;
1871
1872
    /**
1873
     * Replace \c oldAppender  with \c newAppender.
1874
     * @return true if oldAppender was replaced with newAppender.
1875
     */
1876
    bool replaceAppender(const AppenderPtr& oldAppender, const AppenderPtr& newAppender) LOG4CXX_16_VIRTUAL_SPECIFIER;
1877
1878
    /**
1879
     * Replace all previously added appenders with \c newList.
1880
     */
1881
    void replaceAppenders(const AppenderList& newList) LOG4CXX_16_VIRTUAL_SPECIFIER;
1882
1883
    /**
1884
     Set the additivity flag for this logger.
1885
      */
1886
    void setAdditivity(bool additive);
1887
1888
  protected:
1889
    friend class Hierarchy;
1890
1891
    /**
1892
    Only the Hierarchy class can remove the hierarchy of a logger.
1893
    */
1894
    void removeHierarchy();
1895
    /**
1896
    Only the Hierarchy class can set the hierarchy of a logger.
1897
    */
1898
    void setHierarchy(spi::LoggerRepository* repository);
1899
    /**
1900
    Only the Hierarchy class can set the parent of a logger.
1901
    */
1902
    void setParent(LoggerPtr parentLogger);
1903
    /**
1904
    Only the Hierarchy class can change the threshold of a logger.
1905
    */
1906
    void updateThreshold();
1907
1908
  public: // Unit testing support methods
1909
0
    void changeParentTo(const LoggerPtr& otherLogger) { setParent(otherLogger); }
1910
1911
    /** Is m_threshold the same as level->toInt()
1912
     */
1913
    bool isThresholdEqualTo(const LevelPtr& level) const;
1914
1915
    /** Is m_threshold the same as \c other
1916
     */
1917
    bool isThresholdEqualTo(const LoggerPtr& other) const;
1918
1919
    /** Is m_threshold the same as getEffectiveLevel()->toInt()
1920
     */
1921
    bool isThresholdValid() const;
1922
1923
  private:
1924
    spi::LoggerRepository* getHierarchy() const;
1925
1926
  public:
1927
    /**
1928
    Set the level of this logger.
1929
1930
    <p>As in <code>logger->setLevel(Level::getDebug());</code>
1931
1932
    <p>Null values are admitted.  */
1933
    virtual void setLevel(const LevelPtr level);
1934
1935
    /**
1936
    Set the resource bundle to be used with localized logging methods.
1937
    */
1938
    void setResourceBundle(const helpers::ResourceBundlePtr& bundle);
1939
1940
#if LOG4CXX_WCHAR_T_API
1941
    /**
1942
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>WARN</code> events.
1943
1944
    <p>This method first checks if this logger is <code>WARN</code>
1945
    enabled by comparing the level of this logger with the
1946
    WARN level. If this logger is
1947
    <code>WARN</code> enabled, it proceeds to call all the
1948
    registered appenders in this logger and also higher in the
1949
    hierarchy depending on the value of the additivity flag.
1950
1951
    @param msg the message string to log.
1952
    @param location The source code location of the logging request.
1953
1954
    See also #LOG4CXX_WARN.
1955
    */
1956
    void warn(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1957
    /**
1958
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>WARN</code> events.
1959
1960
    <p>This method first checks if this logger is <code>WARN</code>
1961
    enabled by comparing the level of this logger with the
1962
    WARN level. If this logger is
1963
    <code>WARN</code> enabled, it proceeds to call all the
1964
    registered appenders in this logger and also higher in the
1965
    hierarchy depending on the value of the additivity flag.
1966
1967
    @param msg the message string to log.
1968
1969
    See also #LOG4CXX_WARN.
1970
    */
1971
    void warn(const std::wstring& msg) const;
1972
#endif
1973
#if LOG4CXX_UNICHAR_API
1974
    /**
1975
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>WARN</code> events.
1976
1977
    <p>This method first checks if this logger is <code>WARN</code>
1978
    enabled by comparing the level of this logger with the
1979
    WARN level. If this logger is
1980
    <code>WARN</code> enabled, it proceeds to call all the
1981
    registered appenders in this logger and also higher in the
1982
    hierarchy depending on the value of the additivity flag.
1983
1984
    @param msg the message string to log.
1985
    @param location The source code location of the logging request.
1986
1987
    See also #LOG4CXX_WARN.
1988
    */
1989
    void warn(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1990
    /**
1991
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>WARN</code> events.
1992
1993
    <p>This method first checks if this logger is <code>WARN</code>
1994
    enabled by comparing the level of this logger with the
1995
    WARN level. If this logger is
1996
    <code>WARN</code> enabled, it proceeds to call all the
1997
    registered appenders in this logger and also higher in the
1998
    hierarchy depending on the value of the additivity flag.
1999
2000
    @param msg the message string to log.
2001
2002
    See also #LOG4CXX_WARN.
2003
    */
2004
    void warn(const std::basic_string<UniChar>& msg) const;
2005
#endif
2006
#if LOG4CXX_CFSTRING_API
2007
    /**
2008
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>WARN</code> events.
2009
2010
    <p>This method first checks if this logger is <code>WARN</code>
2011
    enabled by comparing the level of this logger with the
2012
    WARN level. If this logger is
2013
    <code>WARN</code> enabled, it proceeds to call all the
2014
    registered appenders in this logger and also higher in the
2015
    hierarchy depending on the value of the additivity flag.
2016
2017
    @param msg the message string to log.
2018
    @param location The source code location of the logging request.
2019
2020
    See also #LOG4CXX_WARN.
2021
    */
2022
    void warn(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2023
    /**
2024
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>WARN</code> events.
2025
2026
    <p>This method first checks if this logger is <code>WARN</code>
2027
    enabled by comparing the level of this logger with the
2028
    WARN level. If this logger is
2029
    <code>WARN</code> enabled, it proceeds to call all the
2030
    registered appenders in this logger and also higher in the
2031
    hierarchy depending on the value of the additivity flag.
2032
2033
    @param msg the message string to log.
2034
2035
    See also #LOG4CXX_WARN.
2036
    */
2037
    void warn(const CFStringRef& msg) const;
2038
#endif
2039
    /**
2040
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>WARN</code> events.
2041
2042
    <p>This method first checks if this logger is <code>WARN</code>
2043
    enabled by comparing the level of this logger with the
2044
    WARN level. If this logger is
2045
    <code>WARN</code> enabled, it proceeds to call all the
2046
    registered appenders in this logger and also higher in the
2047
    hierarchy depending on the value of the additivity flag.
2048
2049
    @param msg the message string to log.
2050
    @param location The source code location of the logging request.
2051
2052
    See also #LOG4CXX_WARN.
2053
    */
2054
    void warn(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2055
    /**
2056
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>WARN</code> events.
2057
2058
    <p>This method first checks if this logger is <code>WARN</code>
2059
    enabled by comparing the level of this logger with the
2060
    WARN level. If this logger is
2061
    <code>WARN</code> enabled, it proceeds to call all the
2062
    registered appenders in this logger and also higher in the
2063
    hierarchy depending on the value of the additivity flag.
2064
2065
    @param msg the message string to log.
2066
2067
    See also #LOG4CXX_WARN.
2068
    */
2069
    void warn(const std::string& msg) const;
2070
2071
#if LOG4CXX_WCHAR_T_API
2072
    /**
2073
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>TRACE</code> events.
2074
2075
    <p>This method first checks if this logger is <code>TRACE</code>
2076
    enabled by comparing the level of this logger with the
2077
    TRACE level. If this logger is
2078
    <code>TRACE</code> enabled, it proceeds to call all the
2079
    registered appenders in this logger and also higher in the
2080
    hierarchy depending on the value of the additivity flag.
2081
2082
    @param msg the message string to log.
2083
    @param location The source code location of the logging request.
2084
2085
    See also #LOG4CXX_TRACE.
2086
    */
2087
    void trace(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2088
    /**
2089
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>TRACE</code> events.
2090
2091
    <p>This method first checks if this logger is <code>TRACE</code>
2092
    enabled by comparing the level of this logger with the
2093
    TRACE level. If this logger is
2094
    <code>TRACE</code> enabled, it proceeds to call all the
2095
    registered appenders in this logger and also higher in the
2096
    hierarchy depending on the value of the additivity flag.
2097
2098
    @param msg the message string to log.
2099
2100
    See also #LOG4CXX_TRACE.
2101
    */
2102
    void trace(const std::wstring& msg) const;
2103
#endif
2104
#if LOG4CXX_UNICHAR_API
2105
    /**
2106
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>TRACE</code> events.
2107
2108
    <p>This method first checks if this logger is <code>TRACE</code>
2109
    enabled by comparing the level of this logger with the
2110
    TRACE level. If this logger is
2111
    <code>TRACE</code> enabled, it proceeds to call all the
2112
    registered appenders in this logger and also higher in the
2113
    hierarchy depending on the value of the additivity flag.
2114
2115
    @param msg the message string to log.
2116
    @param location The source code location of the logging request.
2117
2118
    See also #LOG4CXX_TRACE.
2119
    */
2120
    void trace(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2121
    /**
2122
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>TRACE</code> events.
2123
2124
    <p>This method first checks if this logger is <code>TRACE</code>
2125
    enabled by comparing the level of this logger with the
2126
    TRACE level. If this logger is
2127
    <code>TRACE</code> enabled, it proceeds to call all the
2128
    registered appenders in this logger and also higher in the
2129
    hierarchy depending on the value of the additivity flag.
2130
2131
    @param msg the message string to log.
2132
2133
    See also #LOG4CXX_TRACE.
2134
    */
2135
    void trace(const std::basic_string<UniChar>& msg) const;
2136
#endif
2137
#if LOG4CXX_CFSTRING_API
2138
    /**
2139
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>TRACE</code> events.
2140
2141
    <p>This method first checks if this logger is <code>TRACE</code>
2142
    enabled by comparing the level of this logger with the
2143
    TRACE level. If this logger is
2144
    <code>TRACE</code> enabled, it proceeds to call all the
2145
    registered appenders in this logger and also higher in the
2146
    hierarchy depending on the value of the additivity flag.
2147
2148
    @param msg the message string to log.
2149
    @param location The source code location of the logging request.
2150
2151
    See also #LOG4CXX_TRACE.
2152
    */
2153
    void trace(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2154
    /**
2155
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>TRACE</code> events.
2156
2157
    <p>This method first checks if this logger is <code>TRACE</code>
2158
    enabled by comparing the level of this logger with the
2159
    TRACE level. If this logger is
2160
    <code>TRACE</code> enabled, it proceeds to call all the
2161
    registered appenders in this logger and also higher in the
2162
    hierarchy depending on the value of the additivity flag.
2163
2164
    @param msg the message string to log.
2165
2166
    See also #LOG4CXX_TRACE.
2167
    */
2168
    void trace(const CFStringRef& msg) const;
2169
#endif
2170
    /**
2171
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>TRACE</code> events.
2172
2173
    <p>This method first checks if this logger is <code>TRACE</code>
2174
    enabled by comparing the level of this logger with the
2175
    TRACE level. If this logger is
2176
    <code>TRACE</code> enabled, it proceeds to call all the
2177
    registered appenders in this logger and also higher in the
2178
    hierarchy depending on the value of the additivity flag.
2179
2180
    @param msg the message string to log.
2181
    @param location The source code location of the logging request.
2182
2183
    See also #LOG4CXX_TRACE.
2184
    */
2185
    void trace(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2186
    /**
2187
    Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>TRACE</code> events.
2188
2189
    <p>This method first checks if this logger is <code>TRACE</code>
2190
    enabled by comparing the level of this logger with the
2191
    TRACE level. If this logger is
2192
    <code>TRACE</code> enabled, it proceeds to call all the
2193
    registered appenders in this logger and also higher in the
2194
    hierarchy depending on the value of the additivity flag.
2195
2196
    @param msg the message string to log.
2197
2198
    See also #LOG4CXX_TRACE.
2199
    */
2200
    void trace(const std::string& msg) const;
2201
2202
    /**
2203
     * Replace all current appenders with \c newList and
2204
     * set the additivity flag to \c newAdditivity.
2205
     *
2206
     * @param newList The appenders to set.
2207
     * @param newAdditivity Whether this logger should send events to its parent.
2208
     */
2209
    void reconfigure( const AppenderList& newList, bool newAdditivity );
2210
2211
  private:
2212
    //
2213
    //  prevent copy and assignment
2214
    Logger(const Logger&);
2215
    Logger& operator=(const Logger&);
2216
};
2217
LOG4CXX_LIST_DEF(LoggerList, LoggerPtr);
2218
}
2219
2220
#if !defined(LOG4CXX_UNLIKELY)
2221
  #if __GNUC__ >= 3
2222
    /**
2223
    Provides optimization hint to the compiler
2224
    to optimize for the expression being false.
2225
    @param expr boolean expression.
2226
    @returns value of expression.
2227
    */
2228
0
    #define LOG4CXX_UNLIKELY(expr) __builtin_expect(expr, 0)
2229
  #else
2230
    /**
2231
    Provides optimization hint to the compiler
2232
    to optimize for the expression being false.
2233
    @param expr boolean expression.
2234
    @returns value of expression.
2235
    **/
2236
    #define LOG4CXX_UNLIKELY(expr) expr
2237
  #endif
2238
#endif
2239
2240
#if defined(LOG4CXX_ENABLE_STACKTRACE) && !defined(LOG4CXX_STACKTRACE)
2241
  #ifndef __has_include
2242
    #include <boost/stacktrace.hpp>
2243
    #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
2244
  #elif __has_include(<stacktrace>)
2245
    #include <stacktrace>
2246
    #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + std::stacktrace::to_string(std::stacktrace::stacktrace()));
2247
  #elif __has_include(<boost/stacktrace.hpp>)
2248
    #include <boost/stacktrace.hpp>
2249
    #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
2250
  #else
2251
    #warning "Stacktrace requested but no implementation found"
2252
  #endif
2253
#endif /* LOG4CXX_ENABLE_STACKTRACE */
2254
2255
#if !defined(LOG4CXX_STACKTRACE)
2256
#define LOG4CXX_STACKTRACE
2257
#endif
2258
2259
#ifndef LOG4CXX_FMT_VA_ARG
2260
#if __cplusplus >= 202002L
2261
  #define LOG4CXX_FMT_VA_ARG(...) __VA_OPT__(,) __VA_ARGS__
2262
#else
2263
  #define LOG4CXX_FMT_VA_ARG(...) , __VA_ARGS__
2264
#endif
2265
#endif
2266
2267
/** @addtogroup LoggingMacros Logging macros
2268
@{
2269
*/
2270
2271
/**
2272
Add a new logging event containing \c message to attached appender(s) if this logger is enabled for \c events.
2273
2274
@param logger the logger to be used.
2275
@param level The logging event level.
2276
@param message a valid r-value expression of an <code>operator<<(std::ostream&. ...)</code> overload.
2277
*/
2278
#define LOG4CXX_LOG(logger, level, message) do { \
2279
    if (logger->isEnabledFor(level)) {\
2280
      ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2281
      logger->addEvent(level, oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2282
2283
/**
2284
Add a new logging event containing a message defined by \c fmt and <code>...</code> to attached appender(s) if this logger is enabled for \c events.
2285
2286
@param logger the logger to be used.
2287
@param level The logging event level.
2288
@param fmt the layout of the message.
2289
@param ... the variable parts of the message.
2290
*/
2291
#define LOG4CXX_LOG_FMT(logger, level, fmt, ...) do { \
2292
    if (logger->isEnabledFor(level)) {\
2293
      logger->addEvent(level, ::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__) ), LOG4CXX_LOCATION); }} while (0)
2294
2295
/**
2296
Add a new logging event containing \c message to attached appender(s) if this logger is enabled for \c events.
2297
2298
@param logger the logger to be used.
2299
@param level The logging event level.
2300
@param message a valid r-value expression of an <code>operator<<(std::ostream&. ...)</code> overload. in the internal encoding.
2301
*/
2302
#define LOG4CXX_LOGLS(logger, level, message) do { \
2303
    if (logger->isEnabledFor(level)) {\
2304
      ::LOG4CXX_NS::helpers::LogCharMessageBuffer oss_; \
2305
      logger->addEvent(level, oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2306
2307
#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 10000
2308
/**
2309
Add a new logging event containing \c message to attached appender(s) if \c logger is enabled for <code>DEBUG</code> events.
2310
2311
\usage
2312
~~~{.cpp}
2313
LOG4CXX_DEBUG(m_log, "AddMesh:"
2314
  << " name " << meshName
2315
  << " type 0x" << std:: hex << traits.Type
2316
  << " materialName " << meshObject.GetMaterialName()
2317
  << " visible? " << traits.IsDefaultVisible
2318
  << " at " << obj->getBoundingBox().getCenter()
2319
  << " +/- " << obj->getBoundingBox().getHalfSize()
2320
  );
2321
~~~
2322
2323
@param logger the logger that has the enabled status.
2324
@param message a valid r-value expression of an <code>operator<<(std::ostream&. ...)</code> overload.
2325
2326
*/
2327
#define LOG4CXX_DEBUG(logger, message) do { \
2328
    if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isDebugEnabledFor(logger))) {\
2329
      ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2330
      logger->addDebugEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2331
2332
/**
2333
Add a new logging event containing a message defined by \c fmt and <code>...</code> to attached appender(s) if \c logger is enabled for <code>DEBUG</code> events.
2334
2335
\usage
2336
~~~{.cpp}
2337
LOG4CXX_DEBUG_FMT(m_log, "AddMesh: name {} type 0x{x} materialName {} visible? {d} at {} +/- {}"
2338
  , meshName
2339
  , traits.Type
2340
  , meshObject.GetMaterialName()
2341
  , traits.IsDefaultVisible
2342
  , obj->getBoundingBox().getCenter()
2343
  , obj->getBoundingBox().getHalfSize()
2344
  );
2345
~~~
2346
2347
@param logger the logger to be used.
2348
@param fmt the layout of the message.
2349
@param ... the variable parts of the message.
2350
*/
2351
#define LOG4CXX_DEBUG_FMT(logger, fmt, ...) do { \
2352
    if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isDebugEnabledFor(logger))) {\
2353
      logger->addDebugEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__) ), LOG4CXX_LOCATION); }} while (0)
2354
#else
2355
#define LOG4CXX_DEBUG(logger, message)
2356
#define LOG4CXX_DEBUG_FMT(logger, fmt, ...)
2357
#endif
2358
2359
#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 5000
2360
/**
2361
Add a new logging event containing \c message to attached appender(s) if \c logger is enabled for <code>TRACE</code> events.
2362
2363
\usage
2364
~~~{.cpp}
2365
    LOG4CXX_TRACE(m_log, "AddVertex:" << " at " << p << " n " << n << ' ' << color);
2366
~~~
2367
2368
@param logger the logger that has the enabled status.
2369
@param message a valid r-value expression of an <code>operator<<(std::ostream&. ...)</code> overload.
2370
*/
2371
#define LOG4CXX_TRACE(logger, message) do { \
2372
    if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isTraceEnabledFor(logger))) {\
2373
      ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2374
      logger->addTraceEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2375
2376
/**
2377
Add a new logging event containing a message defined by \c fmt and <code>...</code> to attached appender(s) if \c logger is enabled for <code>TRACE</code> events.
2378
2379
\usage
2380
~~~{.cpp}
2381
    LOG4CXX_TRACE_FMT(m_log, "AddVertex: at {} n {} {}", p, n, color);
2382
~~~
2383
2384
@param logger the logger to be used.
2385
@param fmt the layout of the message.
2386
@param ... the variable parts of the message.
2387
*/
2388
#define LOG4CXX_TRACE_FMT(logger, fmt, ...) do { \
2389
    if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isTraceEnabledFor(logger))) {\
2390
      logger->addTraceEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2391
#else
2392
#define LOG4CXX_TRACE(logger, message)
2393
#define LOG4CXX_TRACE_FMT(logger, fmt, ...)
2394
#endif
2395
2396
#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 20000
2397
/**
2398
Add a new logging event containing \c message to attached appender(s) if \c logger is enabled for <code>INFO</code> events.
2399
2400
\usage
2401
~~~{.cpp}
2402
LOG4CXX_INFO(m_log, surface->GetName()
2403
  << " successfully planned " << std::fixed << std::setprecision(1) << ((plannedArea  / (plannedArea + unplannedArea)) * 100.0) << "%"
2404
  << " planned area " << std::fixed << std::setprecision(4) << plannedArea << "m^2"
2405
  << " unplanned area " << unplannedArea << "m^2"
2406
  << " planned segments " << surface->GetSegmentPlanCount() << " of " << surface->GetSegmentCount()
2407
  );
2408
~~~
2409
2410
@param logger the logger that has the enabled status.
2411
@param message a valid r-value expression of an <code>operator<<(std::ostream&. ...)</code> overload.
2412
*/
2413
44.7k
#define LOG4CXX_INFO(logger, message) do { \
2414
44.7k
    if (::LOG4CXX_NS::Logger::isInfoEnabledFor(logger)) {\
2415
44.7k
      ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2416
44.7k
      logger->addInfoEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2417
2418
/**
2419
Add a new logging event containing a message defined by \c fmt and <code>...</code> to attached appender(s) if \c logger is enabled for <code>INFO</code> events.
2420
2421
\usage
2422
~~~{.cpp}
2423
LOG4CXX_INFO_FMT(m_log, "{} successfully planned {:.1f}% planned area {:.4f}m^2 unplanned area {:.4f}m^2 planned segments {:d} of {:d}"
2424
    , surface->GetName(), (plannedArea  / (plannedArea + unplannedArea)) * 100.0
2425
  , plannedArea, unplannedArea
2426
  , surface->GetSegmentPlanCount(), surface->GetSegmentCount()
2427
  );
2428
~~~
2429
2430
@param logger the logger to be used.
2431
@param fmt the layout of the message.
2432
@param ... the variable parts of the message.
2433
*/
2434
#define LOG4CXX_INFO_FMT(logger, fmt, ...) do { \
2435
    if (::LOG4CXX_NS::Logger::isInfoEnabledFor(logger)) {\
2436
      logger->addInfoEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2437
#else
2438
#define LOG4CXX_INFO(logger, message)
2439
#define LOG4CXX_INFO_FMT(logger, fmt, ...)
2440
#endif
2441
2442
#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 30000
2443
/**
2444
Add a new logging event containing \c message to attached appender(s) if \c logger is enabled for <code>WARN</code> events.
2445
2446
\usage
2447
~~~{.cpp}
2448
catch (const std::exception& ex)
2449
{
2450
    LOG4CXX_WARN(m_log, ex.what() << ": in " << m_task->GetParamFilePath());
2451
}
2452
~~~
2453
2454
@param logger the logger to be used.
2455
@param message a valid r-value expression of an <code>operator<<(std::ostream&. ...)</code> overload.
2456
*/
2457
#define LOG4CXX_WARN(logger, message) do { \
2458
    if (::LOG4CXX_NS::Logger::isWarnEnabledFor(logger)) {\
2459
      ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2460
      logger->addWarnEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2461
2462
/**
2463
Add a new logging event containing a message defined by \c fmt and <code>...</code> to attached appender(s) if \c logger is enabled for <code>WARN</code> events.
2464
2465
\usage
2466
~~~{.cpp}
2467
catch (const std::exception& ex)
2468
{
2469
    LOG4CXX_WARN_FMT(m_log, "{}: in {}", ex.what(), m_task->GetParamFilePath());
2470
}
2471
~~~
2472
2473
@param logger the logger to be used.
2474
@param fmt the layout of the message.
2475
@param ... the variable parts of the message.
2476
*/
2477
#define LOG4CXX_WARN_FMT(logger, fmt, ...) do { \
2478
    if (::LOG4CXX_NS::Logger::isWarnEnabledFor(logger)) {\
2479
      logger->addWarnEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2480
#else
2481
#define LOG4CXX_WARN(logger, message)
2482
#define LOG4CXX_WARN_FMT(logger, fmt, ...)
2483
#endif
2484
2485
#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 40000
2486
/**
2487
Add a new logging event containing \c message to attached appender(s) if \c logger is enabled for <code>ERROR</code> events.
2488
2489
\usage
2490
~~~{.cpp}
2491
catch (std::exception& ex)
2492
{
2493
  LOG4CXX_ERROR(m_log, ex.what() << " in AddScanData");
2494
}
2495
~~~
2496
2497
@param logger the logger to be used.
2498
@param message a valid r-value expression of an <code>operator<<(std::ostream&. ...)</code> overload.
2499
*/
2500
#define LOG4CXX_ERROR(logger, message) do { \
2501
    if (::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2502
      ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2503
      logger->addErrorEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2504
2505
/**
2506
Add a new logging event containing a message defined by \c fmt and <code>...</code> to attached appender(s) if \c logger is enabled for <code>ERROR</code> events.
2507
2508
\usage
2509
~~~{.cpp}
2510
catch (std::exception& ex)
2511
{
2512
  LOG4CXX_ERROR_FMT(m_log, "{} in AddScanData", ex.what());
2513
}
2514
~~~
2515
2516
@param logger the logger to be used.
2517
@param fmt the layout of the message.
2518
@param ... the variable parts of the message.
2519
*/
2520
#define LOG4CXX_ERROR_FMT(logger, fmt, ...) do { \
2521
    if (::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2522
      logger->addErrorEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2523
2524
/**
2525
If \c condition is not true, add a new logging event containing \c message to attached appender(s) if \c logger is enabled for <code>ERROR</code> events.
2526
2527
@param logger the logger to be used.
2528
@param condition condition
2529
@param message a valid r-value expression of an <code>operator<<(std::ostream&. ...)</code> overload.
2530
*/
2531
#define LOG4CXX_ASSERT(logger, condition, message) do { \
2532
    if (!(condition) && ::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2533
      ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2534
      LOG4CXX_STACKTRACE \
2535
      logger->addErrorEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2536
2537
/**
2538
If \c condition is not true, add a new logging event containing
2539
a message defined by \c fmt and <code>...</code> to attached appender(s)
2540
if \c logger is enabled for <code>ERROR</code> events.
2541
2542
@param logger the logger to be used.
2543
@param condition condition
2544
@param fmt the layout of the message.
2545
@param ... the variable parts of the message.
2546
*/
2547
#define LOG4CXX_ASSERT_FMT(logger, condition, fmt, ...) do { \
2548
    if (!(condition) && ::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2549
      LOG4CXX_STACKTRACE \
2550
      logger->addErrorEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2551
2552
#else
2553
#define LOG4CXX_ERROR(logger, message)
2554
#define LOG4CXX_ERROR_FMT(logger, fmt, ...)
2555
#define LOG4CXX_ASSERT(logger, condition, message)
2556
#define LOG4CXX_ASSERT_FMT(logger, condition, fmt, ...)
2557
#endif
2558
2559
#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 50000
2560
/**
2561
Add a new logging event containing \c message to attached appender(s) if \c logger is enabled for <code>FATAL</code> events.
2562
2563
\usage
2564
~~~{.cpp}
2565
LOG4CXX_FATAL(m_log, m_renderSystem->getName() << " is not supported");
2566
~~~
2567
2568
@param logger the logger to be used.
2569
@param message a valid r-value expression of an <code>operator<<(std::ostream&. ...)</code> overload.
2570
*/
2571
#define LOG4CXX_FATAL(logger, message) do { \
2572
    if (::LOG4CXX_NS::Logger::isFatalEnabledFor(logger)) {\
2573
      ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2574
      logger->addFatalEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2575
2576
/**
2577
Add a new logging event containing a message defined by \c fmt and <code>...</code> to attached appender(s) if \c logger is enabled for <code>FATAL</code> events.
2578
2579
\usage
2580
~~~{.cpp}
2581
LOG4CXX_FATAL_FMT(m_log, "{} is not supported", m_renderSystem->getName());
2582
~~~
2583
@param logger the logger to be used.
2584
@param fmt the layout of the message.
2585
@param ... the variable parts of the message.
2586
2587
*/
2588
#define LOG4CXX_FATAL_FMT(logger, fmt, ...) do { \
2589
    if (::LOG4CXX_NS::Logger::isFatalEnabledFor(logger)) {\
2590
      logger->addFatalEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2591
#else
2592
#define LOG4CXX_FATAL(logger, message)
2593
#define LOG4CXX_FATAL_FMT(logger, fmt, ...)
2594
#endif
2595
2596
/**
2597
Add a new logging event containing the localized message \c key to attached appender(s) if \c logger is enabled for \c level events.
2598
2599
@param logger the logger to be used.
2600
@param level The logging event level.
2601
@param key the key to be searched in the resourceBundle of the logger.
2602
*/
2603
#define LOG4CXX_L7DLOG(logger, level, key) do { \
2604
    if (logger->isEnabledFor(level)) {\
2605
      logger->l7dlog(level, key, LOG4CXX_LOCATION); }} while (0)
2606
2607
/**
2608
Add a new logging event containing the localized message \c key to attached appender(s) if \c logger is enabled for \c level events with one parameter.
2609
2610
@param logger the logger to be used.
2611
@param level The logging event level.
2612
@param key the key to be searched in the resourceBundle of the logger.
2613
@param p1 the unique parameter.
2614
*/
2615
#define LOG4CXX_L7DLOG1(logger, level, key, p1) do { \
2616
    if (logger->isEnabledFor(level)) {\
2617
      logger->l7dlog(level, key, LOG4CXX_LOCATION, p1); }} while (0)
2618
2619
/**
2620
Add a new logging event containing the localized message \c key to attached appender(s) if \c logger is enabled for \c level events with two parameters.
2621
2622
@param logger the logger to be used.
2623
@param level The logging event level.
2624
@param key the key to be searched in the resourceBundle of the logger.
2625
@param p1 the first parameter.
2626
@param p2 the second parameter.
2627
*/
2628
#define LOG4CXX_L7DLOG2(logger, level, key, p1, p2) do { \
2629
    if (logger->isEnabledFor(level)) {\
2630
      logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2); }} while (0)
2631
2632
/**
2633
Add a new logging event containing the localized message \c key to attached appender(s) if \c logger is enabled for \c level events with three parameters.
2634
2635
@param logger the logger to be used.
2636
@param level The logging event level.
2637
@param key the key to be searched in the resourceBundle of the logger.
2638
@param p1 the first parameter.
2639
@param p2 the second parameter.
2640
@param p3 the third parameter.
2641
*/
2642
#define LOG4CXX_L7DLOG3(logger, level, key, p1, p2, p3) do { \
2643
    if (logger->isEnabledFor(level)) {\
2644
      logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2, p3); }} while (0)
2645
2646
/**@}*/
2647
2648
#include <log4cxx/spi/loggerrepository.h>
2649
2650
#endif //_LOG4CXX_LOGGER_H