Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: base/logging.h

Issue 2163023002: Unify usage of logging/assert macros in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_LOGGING_H_ 5 #ifndef BASE_LOGGING_H_
6 #define BASE_LOGGING_H_ 6 #define BASE_LOGGING_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <cassert> 10 #include <cassert>
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 635
636 #define DLOG_IS_ON(severity) false 636 #define DLOG_IS_ON(severity) false
637 #define DLOG_IF(severity, condition) EAT_STREAM_PARAMETERS 637 #define DLOG_IF(severity, condition) EAT_STREAM_PARAMETERS
638 #define DLOG_ASSERT(condition) EAT_STREAM_PARAMETERS 638 #define DLOG_ASSERT(condition) EAT_STREAM_PARAMETERS
639 #define DPLOG_IF(severity, condition) EAT_STREAM_PARAMETERS 639 #define DPLOG_IF(severity, condition) EAT_STREAM_PARAMETERS
640 #define DVLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS 640 #define DVLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
641 #define DVPLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS 641 #define DVPLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
642 642
643 #endif // ENABLE_DLOG 643 #endif // ENABLE_DLOG
644 644
645 // DEBUG_MODE is for uses like 645 // DEBUG_MODE is for runtime uses like
646 // if (DEBUG_MODE) foo.CheckThatFoo(); 646 // if (DEBUG_MODE) foo.CheckThatFoo();
647 // instead of 647 // We tie its state to ENABLE_DLOG.
648 // #ifndef NDEBUG
649 // foo.CheckThatFoo();
650 // #endif
651 // 648 //
652 // We tie its state to ENABLE_DLOG. 649 // For compile-time checks, #if ENABLE_DLOG can be used.
653 enum { DEBUG_MODE = ENABLE_DLOG }; 650 enum { DEBUG_MODE = ENABLE_DLOG };
654 651
655 #undef ENABLE_DLOG
danakj 2016/07/19 20:17:01 Hm.. idk why we need both here. Can we just delete
gab 2016/07/20 02:43:58 Sure, though it's a bit weird to have #if DCHECK_
656
657 #define DLOG(severity) \ 652 #define DLOG(severity) \
658 LAZY_STREAM(LOG_STREAM(severity), DLOG_IS_ON(severity)) 653 LAZY_STREAM(LOG_STREAM(severity), DLOG_IS_ON(severity))
659 654
660 #define DPLOG(severity) \ 655 #define DPLOG(severity) \
661 LAZY_STREAM(PLOG_STREAM(severity), DLOG_IS_ON(severity)) 656 LAZY_STREAM(PLOG_STREAM(severity), DLOG_IS_ON(severity))
662 657
663 #define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) 658 #define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel))
664 659
665 #define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) 660 #define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel))
666 661
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 #elif NOTIMPLEMENTED_POLICY == 5 983 #elif NOTIMPLEMENTED_POLICY == 5
989 #define NOTIMPLEMENTED() do {\ 984 #define NOTIMPLEMENTED() do {\
990 static bool logged_once = false;\ 985 static bool logged_once = false;\
991 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ 986 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
992 logged_once = true;\ 987 logged_once = true;\
993 } while(0);\ 988 } while(0);\
994 EAT_STREAM_PARAMETERS 989 EAT_STREAM_PARAMETERS
995 #endif 990 #endif
996 991
997 #endif // BASE_LOGGING_H_ 992 #endif // BASE_LOGGING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698