OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 | 787 |
788 // A non-macro interface to the log facility; (useful | 788 // A non-macro interface to the log facility; (useful |
789 // when the logging level is not a compile-time constant). | 789 // when the logging level is not a compile-time constant). |
790 inline void LogAtLevel(int const log_level, std::string const &msg) { | 790 inline void LogAtLevel(int const log_level, std::string const &msg) { |
791 LogMessage(__FILE__, __LINE__, log_level).stream() << msg; | 791 LogMessage(__FILE__, __LINE__, log_level).stream() << msg; |
792 } | 792 } |
793 | 793 |
794 // This class is used to explicitly ignore values in the conditional | 794 // This class is used to explicitly ignore values in the conditional |
795 // logging macros. This avoids compiler warnings like "value computed | 795 // logging macros. This avoids compiler warnings like "value computed |
796 // is not used" and "statement has no effect". | 796 // is not used" and "statement has no effect". |
797 class BASE_API LogMessageVoidify { | 797 class LogMessageVoidify { |
798 public: | 798 public: |
799 LogMessageVoidify() { } | 799 LogMessageVoidify() { } |
800 // This has to be an operator with a precedence lower than << but | 800 // This has to be an operator with a precedence lower than << but |
801 // higher than ?: | 801 // higher than ?: |
802 void operator&(std::ostream&) { } | 802 void operator&(std::ostream&) { } |
803 }; | 803 }; |
804 | 804 |
805 #if defined(OS_WIN) | 805 #if defined(OS_WIN) |
806 typedef unsigned long SystemErrorCode; | 806 typedef unsigned long SystemErrorCode; |
807 #elif defined(OS_POSIX) | 807 #elif defined(OS_POSIX) |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 namespace base { | 937 namespace base { |
938 | 938 |
939 class StringPiece; | 939 class StringPiece; |
940 | 940 |
941 // Allows StringPiece to be logged. | 941 // Allows StringPiece to be logged. |
942 BASE_API std::ostream& operator<<(std::ostream& o, const StringPiece& piece); | 942 BASE_API std::ostream& operator<<(std::ostream& o, const StringPiece& piece); |
943 | 943 |
944 } // namespace base | 944 } // namespace base |
945 | 945 |
946 #endif // BASE_LOGGING_H_ | 946 #endif // BASE_LOGGING_H_ |
OLD | NEW |