-
Notifications
You must be signed in to change notification settings - Fork 120
/
logger.h
2475 lines (2061 loc) · 92.9 KB
/
logger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _LOG4CXX_LOGGER_H
#define _LOG4CXX_LOGGER_H
#include <log4cxx/helpers/appenderattachableimpl.h>
#include <log4cxx/level.h>
#include <log4cxx/helpers/pool.h>
#include <log4cxx/spi/location/locationinfo.h>
#include <log4cxx/helpers/resourcebundle.h>
#include <log4cxx/helpers/messagebuffer.h>
namespace LOG4CXX_NS
{
namespace spi
{
class LoggerRepository;
LOG4CXX_PTR_DEF(LoggerRepository);
class LoggerFactory;
LOG4CXX_PTR_DEF(LoggerFactory);
}
class Logger;
/** smart pointer to a Logger class */
LOG4CXX_PTR_DEF(Logger);
LOG4CXX_LIST_DEF(LoggerList, LoggerPtr);
/**
This is the central class in the log4cxx package. Most logging
operations, except configuration, are done through this class.
*/
class LOG4CXX_EXPORT Logger :
public virtual LOG4CXX_NS::spi::AppenderAttachable
{
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(Logger)
BEGIN_LOG4CXX_CAST_MAP()
LOG4CXX_CAST_ENTRY(Logger)
LOG4CXX_CAST_ENTRY(spi::AppenderAttachable)
END_LOG4CXX_CAST_MAP()
private:
LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(LoggerPrivate, m_priv)
int m_threshold; //!< The cached level of this logger
public:
/**
This constructor initializes a new <code>logger</code> instance and
sets its name.
<p>It is intended to be only used by factory-classes.
@param pool lifetime of pool must be longer than logger.
@param name The name of the logger.
*/
Logger(helpers::Pool& pool, const LogString& name);
~Logger();
/**
Add <code>newAppender</code> to the list of appenders of this
Logger instance.
<p>If <code>newAppender</code> is already in the list of
appenders, then it won't be added again.
*/
void addAppender(const AppenderPtr newAppender) override;
/**
Call the appenders in the hierrachy starting at
<code>this</code>. If no appenders could be found, emit a
warning.
<p>This method calls all the appenders inherited from the
hierarchy circumventing any evaluation of whether to log or not
to log the particular log request.
@param event the event to log.
@param p memory pool for any allocations needed to process request.
*/
void callAppenders(const LOG4CXX_NS::spi::LoggingEventPtr& event, LOG4CXX_NS::helpers::Pool& p) const;
/**
Close all attached appenders implementing the AppenderAttachable
interface.
*/
void closeNestedAppenders();
/**
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.
<p>This method first checks if this logger is <code>DEBUG</code>
enabled by comparing the level of this logger with the
DEBUG level. If this logger is
<code>DEBUG</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
*/
void debug(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
<p>This method first checks if this logger is <code>DEBUG</code>
enabled by comparing the level of this logger with the
DEBUG level. If this logger is
<code>DEBUG</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_DEBUG.
*/
void debug(const std::string& msg) const;
#if LOG4CXX_WCHAR_T_API
/**
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.
<p>This method first checks if this logger is <code>DEBUG</code>
enabled by comparing the level of this logger with the
DEBUG level. If this logger is
<code>DEBUG</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_DEBUG.
*/
void debug(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
<p>This method first checks if this logger is <code>DEBUG</code>
enabled by comparing the level of this logger with the
DEBUG level. If this logger is
<code>DEBUG</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_DEBUG.
*/
void debug(const std::wstring& msg) const;
#endif
#if LOG4CXX_UNICHAR_API
/**
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.
<p>This method first checks if this logger is <code>DEBUG</code>
enabled by comparing the level of this logger with the
DEBUG level. If this logger is
<code>DEBUG</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_DEBUG.
*/
void debug(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
<p>This method first checks if this logger is <code>DEBUG</code>
enabled by comparing the level of this logger with the
DEBUG level. If this logger is
<code>DEBUG</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_DEBUG.
*/
void debug(const std::basic_string<UniChar>& msg) const;
#endif
#if LOG4CXX_CFSTRING_API
/**
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.
<p>This method first checks if this logger is <code>DEBUG</code>
enabled by comparing the level of this logger with the
DEBUG level. If this logger is
<code>DEBUG</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_DEBUG.
*/
void debug(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>DEBUG</code> events.
<p>This method first checks if this logger is <code>DEBUG</code>
enabled by comparing the level of this logger with the
DEBUG level. If this logger is
<code>DEBUG</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_DEBUG.
*/
void debug(const CFStringRef& msg) const;
#endif
/**
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.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_ERROR.
*/
void error(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_ERROR.
*/
void error(const std::string& msg) const;
#if LOG4CXX_WCHAR_T_API
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_ERROR.
*/
void error(const std::wstring& msg) const;
/**
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.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_ERROR.
*/
void error(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
#endif
#if LOG4CXX_UNICHAR_API
/**
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.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_ERROR.
*/
void error(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_ERROR.
*/
void error(const std::basic_string<UniChar>& msg) const;
#endif
#if LOG4CXX_CFSTRING_API
/**
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.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_ERROR.
*/
void error(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_ERROR.
*/
void error(const CFStringRef& msg) const;
#endif
/**
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.
<p>This method first checks if this logger is <code>FATAL</code>
enabled by comparing the level of this logger with the
FATAL level. If this logger is
<code>FATAL</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_FATAL.
*/
void fatal(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_FATAL.
*/
void fatal(const std::string& msg) const;
#if LOG4CXX_WCHAR_T_API
/**
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.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_FATAL.
*/
void fatal(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_FATAL.
*/
void fatal(const std::wstring& msg) const;
#endif
#if LOG4CXX_UNICHAR_API
/**
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.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_FATAL.
*/
void fatal(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_FATAL.
*/
void fatal(const std::basic_string<UniChar>& msg) const;
#endif
#if LOG4CXX_CFSTRING_API
/**
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.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_FATAL.
*/
void fatal(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>ERROR</code> events.
<p>This method first checks if this logger is <code>ERROR</code>
enabled by comparing the level of this logger with the
ERROR level. If this logger is
<code>ERROR</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_FATAL.
*/
void fatal(const CFStringRef& msg) const;
#endif
/**
Add a new logging event containing \c message and \c location to attached appender(s).
without further checks.
@param level The logging event level.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addEvent(const LevelPtr& level, std::string&& message
, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new info level logging event containing \c message and \c location to attached appender(s).
without further checks.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addInfoEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new debug level logging event containing \c message and \c location to attached appender(s).
without further checks.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addDebugEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new trace level logging event containing \c message and \c location to attached appender(s).
without further checks.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addTraceEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new logging event containing \c message and \c location to attached appender(s).
without further checks.
@param level The logging event level.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void forcedLog(const LevelPtr& level, const std::string& message,
const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c message to attached appender(s).
without further checks.
@param level The logging event level.
@param message The text to add to the logging event.
*/
void forcedLog(const LevelPtr& level, const std::string& message) const;
#if LOG4CXX_WCHAR_T_API
/**
Add a new logging event containing \c message and \c location to attached appender(s).
without further checks.
@param level The logging event level.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addEvent(const LevelPtr& level, std::wstring&& message
, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new info level logging event containing \c message and \c location to attached appender(s).
without further checks.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addInfoEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new debug level logging event containing \c message and \c location to attached appender(s).
without further checks.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addDebugEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new trace level logging event containing \c message and \c location to attached appender(s).
without further checks.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addTraceEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new logging event containing \c message and \c location to attached appender(s).
without further checks.
@param level The logging event level.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void forcedLog(const LevelPtr& level, const std::wstring& message,
const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c message to attached appender(s).
without further checks.
@param level The logging event level.
@param message The text to add to the logging event.
*/
void forcedLog(const LevelPtr& level, const std::wstring& message) const;
#endif
#if LOG4CXX_UNICHAR_API
/**
Add a new logging event containing \c message and \c location to attached appender(s).
without further checks.
@param level The logging event level.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addEvent(const LevelPtr& level, std::basic_string<UniChar>&& message,
const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new info level logging event containing \c message and \c location to attached appender(s).
without further checks.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addInfoEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new debug level logging event containing \c message and \c location to attached appender(s).
without further checks.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addDebugEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new trace level logging event containing \c message and \c location to attached appender(s).
without further checks.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void addTraceEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new logging event containing \c message and \c location to attached appender(s).
without further checks.
@param level The logging event level.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message,
const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c message to attached appender(s).
without further checks.
@param level The logging event level.
@param message The text to add to the logging event.
*/
void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
#endif
#if LOG4CXX_CFSTRING_API
/**
Add a new logging event containing \c message and \c location to attached appender(s).
without further checks.
@param level The logging event level.
@param message The text to add to the logging event.
@param location The source code location of the logging request.
*/
void forcedLog(const LevelPtr& level, const CFStringRef& message,
const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c message to attached appender(s).
without further checks.
@param level The logging event level.
@param message The text to add to the logging event.
*/
void forcedLog(const LevelPtr& level, const CFStringRef& message) const;
#endif
/**
Add a new logging event containing \c message and \c location to attached appender(s).
without further checks.
@param level The logging event level.
@param message the message string to log.
@param location location of the logging statement.
*/
void addEventLS(const LevelPtr& level, LogString&& message
, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
/**
Add a new logging event containing \c message and \c location to attached appender(s).
without further checks.
@param level The logging event level.
@param message the message string to log.
@param location location of the logging statement.
*/
void forcedLogLS(const LevelPtr& level, const LogString& message,
const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Get the additivity flag for this logger.
*/
bool getAdditivity() const;
/**
Get the appenders contained in this logger as an AppenderList.
If no appenders can be found, then an empty AppenderList
is returned.
@return AppenderList An collection of the appenders in this logger.*/
AppenderList getAllAppenders() const override;
/**
Look for the appender named as <code>name</code>.
<p>Return the appender with that name if in the list. Return
<code>NULL</code> otherwise. */
AppenderPtr getAppender(const LogString& name) const override;
/**
Starting from this logger, search the logger hierarchy for a
non-null level and return it.
<p>The Logger class is designed so that this method executes as
quickly as possible.
@throws RuntimeException if all levels are null in the hierarchy
*/
virtual const LevelPtr& getEffectiveLevel() const;
/**
Return the the LoggerRepository where this
<code>Logger</code> is attached.
*/
LOG4CXX_NS::spi::LoggerRepository* getLoggerRepository() const;
/**
* Get the logger name.
* @return logger name as LogString.
*/
const LogString& getName() const;
/**
* Put name of this logger into \c name in current encoding.
* @param name buffer to which name is appended.
*/
void getName(std::string& name) const;
#if LOG4CXX_WCHAR_T_API
/**
* Put name of this logger into \c name.
* @param name buffer to which name is appended.
*/
void getName(std::wstring& name) const;
#endif
#if LOG4CXX_UNICHAR_API
/**
* Put name of this logger into \c name.
* @param name buffer to which name is appended.
*/
void getName(std::basic_string<UniChar>& name) const;
#endif
#if LOG4CXX_CFSTRING_API
/**
* Put name of this logger into \c name.
* @param name buffer to which name is appended.
*/
void getName(CFStringRef& name) const;
#endif
/**
The parent of this logger. Note that the parent of a
given logger may change during the lifetime of the logger.
<p>The root logger will return <code>0</code>.
*/
LoggerPtr getParent() const;
/**
The assigned Level, if any, for this logger.
@return Level - the assigned Level, can be null.
*/
const LevelPtr& getLevel() const;
/**
* Retrieve a logger by name in current encoding.
* @param name logger name.
*/
static LoggerPtr getLogger(const std::string& name);
/**
* Retrieve a logger by name in current encoding.
* @param name logger name.
*/
static LoggerPtr getLogger(const char* const name);
#if LOG4CXX_WCHAR_T_API
/**
* Retrieve a logger by name.
* @param name logger name.
*/
static LoggerPtr getLogger(const std::wstring& name);
/**
* Retrieve a logger by name.
* @param name logger name.
*/
static LoggerPtr getLogger(const wchar_t* const name);
#endif
#if LOG4CXX_UNICHAR_API
/**
* Retrieve a logger by name.
* @param name logger name.
*/
static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
#endif
#if LOG4CXX_CFSTRING_API
/**
* Retrieve a logger by name.
* @param name logger name.
*/
static LoggerPtr getLogger(const CFStringRef& name);
#endif
/**
* Retrieve a logger by name in Unicode.
* @param name logger name.
*/
static LoggerPtr getLoggerLS(const LogString& name);
/**
Retrieve the root logger.
*/
static LoggerPtr getRootLogger();
/**
Like #getLogger except that the type of logger
instantiated depends on the type returned by the
LoggerFactory#makeNewLoggerInstance method of the
<code>factory</code> parameter.
<p>This method is intended to be used by sub-classes.
@param name The name of the logger to retrieve.
@param factory A LoggerFactory implementation that will
actually create a new Instance.
*/
static LoggerPtr getLoggerLS(const LogString& name,
const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
/**
Like #getLogger except that the type of logger
instantiated depends on the type returned by the
LoggerFactory#makeNewLoggerInstance method of the
<code>factory</code> parameter.
<p>This method is intended to be used by sub-classes.
@param name The name of the logger to retrieve.
@param factory A LoggerFactory implementation that will
actually create a new Instance.
*/
static LoggerPtr getLogger(const std::string& name,
const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
#if LOG4CXX_WCHAR_T_API
/**
Like #getLogger except that the type of logger
instantiated depends on the type returned by the
LoggerFactory#makeNewLoggerInstance method of the
<code>factory</code> parameter.
<p>This method is intended to be used by sub-classes.
@param name The name of the logger to retrieve.
@param factory A LoggerFactory implementation that will
actually create a new Instance.
*/
static LoggerPtr getLogger(const std::wstring& name,
const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
#endif
#if LOG4CXX_UNICHAR_API
/**
Like #getLogger except that the type of logger
instantiated depends on the type returned by the
LoggerFactory#makeNewLoggerInstance method of the
<code>factory</code> parameter.
<p>This method is intended to be used by sub-classes.
@param name The name of the logger to retrieve.
@param factory A LoggerFactory implementation that will
actually create a new Instance.
*/
static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
#endif
#if LOG4CXX_CFSTRING_API
/**
Like #getLogger except that the type of logger
instantiated depends on the type returned by the
LoggerFactory#makeNewLoggerInstance method of the
<code>factory</code> parameter.
<p>This method is intended to be used by sub-classes.
@param name The name of the logger to retrieve.
@param factory A LoggerFactory implementation that will
actually create a new Instance.
*/
static LoggerPtr getLogger(const CFStringRef& name,
const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
#endif
/**
Return the <em>inherited</em> ResourceBundle for this logger.
This method walks the hierarchy to find the appropriate resource bundle.
It will return the resource bundle attached to the closest ancestor of
this logger, much like the way priorities are searched. In case there
is no bundle in the hierarchy then <code>NULL</code> is returned.
*/
helpers::ResourceBundlePtr getResourceBundle() const;
protected:
/**
Returns the string resource corresponding to <code>key</code> in this
logger's inherited resource bundle.
If the resource cannot be found, then an {@link #error error} message
will be logged complaining about the missing resource.
@see #getResourceBundle.
*/
LogString getResourceBundleString(const LogString& key) const;
public:
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
<p>This method first checks if this logger is <code>INFO</code>
enabled by comparing the level of this logger with the
INFO level. If this logger is
<code>INFO</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_INFO.
*/
void info(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
<p>This method first checks if this logger is <code>INFO</code>
enabled by comparing the level of this logger with the
INFO level. If this logger is
<code>INFO</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_INFO.
*/
void info(const std::string& msg) const;
#if LOG4CXX_WCHAR_T_API
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
<p>This method first checks if this logger is <code>INFO</code>
enabled by comparing the level of this logger with the
INFO level. If this logger is
<code>INFO</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
@param location The source code location of the logging request.
See also #LOG4CXX_INFO.
*/
void info(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
<p>This method first checks if this logger is <code>INFO</code>
enabled by comparing the level of this logger with the
INFO level. If this logger is
<code>INFO</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.
@param msg the message string to log.
See also #LOG4CXX_INFO.
*/
void info(const std::wstring& msg) const;
#endif
#if LOG4CXX_UNICHAR_API
/**
Add a new logging event containing \c msg to attached appender(s) if this logger is enabled for <code>INFO</code> events.
<p>This method first checks if this logger is <code>INFO</code>
enabled by comparing the level of this logger with the
INFO level. If this logger is
<code>INFO</code> enabled, it proceeds to call all the
registered appenders in this logger and also higher in the
hierarchy depending on the value of the additivity flag.