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

Side by Side Diff: base/logging.h

Issue 367063006: Move logging.h's definitions of operator<< into namespace std. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « base/files/file_path_watcher_win.cc ('k') | base/logging.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <cassert> 8 #include <cassert>
9 #include <string> 9 #include <string>
10 #include <cstring> 10 #include <cstring>
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 logging::RawLog(logging::LOG_FATAL, "Check failed: " #condition "\n"); \ 820 logging::RawLog(logging::LOG_FATAL, "Check failed: " #condition "\n"); \
821 } while (0) 821 } while (0)
822 822
823 #if defined(OS_WIN) 823 #if defined(OS_WIN)
824 // Returns the default log file path. 824 // Returns the default log file path.
825 BASE_EXPORT std::wstring GetLogFileFullPath(); 825 BASE_EXPORT std::wstring GetLogFileFullPath();
826 #endif 826 #endif
827 827
828 } // namespace logging 828 } // namespace logging
829 829
830 // Note that "The behavior of a C++ program is undefined if it adds declarations
831 // or definitions to namespace std or to a namespace within namespace std unless
832 // otherwise specified." --C++11[namespace.std]
833 //
834 // We've checked that this particular definition has the intended behavior on
835 // our implementations, but it's prone to breaking in the future, and please
836 // don't imitate this in your own definitions without checking with some
837 // standard library experts.
838 namespace std {
830 // These functions are provided as a convenience for logging, which is where we 839 // These functions are provided as a convenience for logging, which is where we
831 // use streams (it is against Google style to use streams in other places). It 840 // use streams (it is against Google style to use streams in other places). It
832 // is designed to allow you to emit non-ASCII Unicode strings to the log file, 841 // is designed to allow you to emit non-ASCII Unicode strings to the log file,
833 // which is normally ASCII. It is relatively slow, so try not to use it for 842 // which is normally ASCII. It is relatively slow, so try not to use it for
834 // common cases. Non-ASCII characters will be converted to UTF-8 by these 843 // common cases. Non-ASCII characters will be converted to UTF-8 by these
835 // operators. 844 // operators.
836 BASE_EXPORT std::ostream& operator<<(std::ostream& out, const wchar_t* wstr); 845 BASE_EXPORT std::ostream& operator<<(std::ostream& out, const wchar_t* wstr);
837 inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) { 846 inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
838 return out << wstr.c_str(); 847 return out << wstr.c_str();
839 } 848 }
849 }
awong 2014/07/08 00:33:41 nit: } // namespace std
840 850
841 // The NOTIMPLEMENTED() macro annotates codepaths which have 851 // The NOTIMPLEMENTED() macro annotates codepaths which have
842 // not been implemented yet. 852 // not been implemented yet.
843 // 853 //
844 // The implementation of this macro is controlled by NOTIMPLEMENTED_POLICY: 854 // The implementation of this macro is controlled by NOTIMPLEMENTED_POLICY:
845 // 0 -- Do nothing (stripped by compiler) 855 // 0 -- Do nothing (stripped by compiler)
846 // 1 -- Warn at compile time 856 // 1 -- Warn at compile time
847 // 2 -- Fail at compile time 857 // 2 -- Fail at compile time
848 // 3 -- Fail at runtime (DCHECK) 858 // 3 -- Fail at runtime (DCHECK)
849 // 4 -- [default] LOG(ERROR) at runtime 859 // 4 -- [default] LOG(ERROR) at runtime
(...skipping 30 matching lines...) Expand all
880 #elif NOTIMPLEMENTED_POLICY == 5 890 #elif NOTIMPLEMENTED_POLICY == 5
881 #define NOTIMPLEMENTED() do {\ 891 #define NOTIMPLEMENTED() do {\
882 static bool logged_once = false;\ 892 static bool logged_once = false;\
883 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ 893 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
884 logged_once = true;\ 894 logged_once = true;\
885 } while(0);\ 895 } while(0);\
886 EAT_STREAM_PARAMETERS 896 EAT_STREAM_PARAMETERS
887 #endif 897 #endif
888 898
889 #endif // BASE_LOGGING_H_ 899 #endif // BASE_LOGGING_H_
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_win.cc ('k') | base/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698