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

Side by Side Diff: base/logging.h

Issue 2296783002: Adds new logging type SYSLOG which logs to the system log. (Closed)
Patch Set: Copy/paste error. Created 4 years, 3 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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 LogMessage(const char* file, int line, std::string* result); 788 LogMessage(const char* file, int line, std::string* result);
789 789
790 // Used for DCHECK_EQ(), etc. Takes ownership of the given string. 790 // Used for DCHECK_EQ(), etc. Takes ownership of the given string.
791 LogMessage(const char* file, int line, LogSeverity severity, 791 LogMessage(const char* file, int line, LogSeverity severity,
792 std::string* result); 792 std::string* result);
793 793
794 ~LogMessage(); 794 ~LogMessage();
795 795
796 std::ostream& stream() { return stream_; } 796 std::ostream& stream() { return stream_; }
797 797
798 LogSeverity severity() { return severity_; }
799 std::string str() { return stream_.str(); }
800
798 private: 801 private:
799 void Init(const char* file, int line); 802 void Init(const char* file, int line);
800 803
801 LogSeverity severity_; 804 LogSeverity severity_;
802 std::ostringstream stream_; 805 std::ostringstream stream_;
803 size_t message_start_; // Offset of the start of the message (past prefix 806 size_t message_start_; // Offset of the start of the message (past prefix
804 // info). 807 // info).
805 // The file and line information passed in to the constructor. 808 // The file and line information passed in to the constructor.
806 const char* file_; 809 const char* file_;
807 const int line_; 810 const int line_;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 #elif NOTIMPLEMENTED_POLICY == 5 988 #elif NOTIMPLEMENTED_POLICY == 5
986 #define NOTIMPLEMENTED() do {\ 989 #define NOTIMPLEMENTED() do {\
987 static bool logged_once = false;\ 990 static bool logged_once = false;\
988 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ 991 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
989 logged_once = true;\ 992 logged_once = true;\
990 } while(0);\ 993 } while(0);\
991 EAT_STREAM_PARAMETERS 994 EAT_STREAM_PARAMETERS
992 #endif 995 #endif
993 996
994 #endif // BASE_LOGGING_H_ 997 #endif // BASE_LOGGING_H_
OLDNEW
« PRESUBMIT.py ('K') | « base/BUILD.gn ('k') | base/syslog_logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698