Go to the documentation of this file.
33 #include <google/protobuf/stubs/common.h>
42 #ifndef WIN32_LEAN_AND_MEAN
43 #define WIN32_LEAN_AND_MEAN // We only need minimal includes
46 #define snprintf _snprintf // see comment in strutil.cc
48 #if defined(__ANDROID__)
49 #include <android/log.h>
52 #include <google/protobuf/stubs/callback.h>
53 #include <google/protobuf/stubs/logging.h>
54 #include <google/protobuf/stubs/once.h>
55 #include <google/protobuf/stubs/status.h>
56 #include <google/protobuf/stubs/stringpiece.h>
57 #include <google/protobuf/stubs/strutil.h>
58 #include <google/protobuf/stubs/int128.h>
60 #include <google/protobuf/port_def.inc>
68 int minLibraryVersion,
73 <<
"This program requires version " <<
VersionString(minLibraryVersion)
74 <<
" of the Protocol Buffer runtime library, but the installed version "
76 "your library. If you compiled the program yourself, make sure that "
77 "your headers are from the same version of Protocol Buffers as your "
78 "link-time library. (Version verification failed in \""
84 <<
"This program was compiled against version "
85 <<
VersionString(headerVersion) <<
" of the Protocol Buffer runtime "
86 "library, which is not compatible with the installed version ("
88 "author for an update. If you compiled the program yourself, make "
89 "sure that your headers are from the same version of Protocol Buffers "
90 "as your link-time library. (Version verification failed in \""
97 int minor = (
version / 1000) % 1000;
103 snprintf(
buffer,
sizeof(
buffer),
"%d.%d.%d", major, minor, micro);
118 #ifndef GOOGLE_PROTOBUF_MIN_LOG_LEVEL
119 #define GOOGLE_PROTOBUF_MIN_LOG_LEVEL LOGLEVEL_INFO
124 #if defined(__ANDROID__)
130 static const char* level_names[] = {
"INFO",
"WARNING",
"ERROR",
"FATAL"};
132 static const int android_log_levels[] = {
140 const int android_log_level = android_log_levels[
level];
141 ::std::ostringstream ostr;
142 ostr <<
"[libprotobuf " << level_names[
level] <<
" " <<
filename <<
":"
146 __android_log_write(android_log_level,
"libprotobuf-native",
149 fprintf(
stderr,
"%s", ostr.str().c_str());
153 if (android_log_level == ANDROID_LOG_FATAL) {
154 __android_log_write(ANDROID_LOG_FATAL,
"libprotobuf-native",
165 static const char* level_names[] = {
"INFO",
"WARNING",
"ERROR",
"FATAL" };
169 fprintf(
stderr,
"[libprotobuf %s %s:%d] %s\n",
204 std::ostringstream
str;
219 #undef DECLARE_STREAM_OPERATOR
220 #define DECLARE_STREAM_OPERATOR(TYPE) \
221 LogMessage& LogMessage::operator<<(TYPE value) { \
222 StrAppend(&message_, value); \
233 #undef DECLARE_STREAM_OPERATOR
240 bool suppress =
false;
251 #if PROTOBUF_USE_EXCEPTIONS
252 throw FatalException(filename_,
line_, message_);
259 void LogFinisher::operator=(
LogMessage& other) {
270 if (new_func ==
nullptr) {
278 LogSilencer::LogSilencer() {
282 LogSilencer::~LogSilencer() {
289 Closure::~Closure() {}
291 namespace internal { FunctionClosure0::~FunctionClosure0() {} }
304 uint8 result_array[4];
306 result_array[0] =
static_cast<uint8>(
x >> 24);
307 result_array[1] =
static_cast<uint8>((
x >> 16) & 0xFF);
308 result_array[2] =
static_cast<uint8>((
x >> 8) & 0xFF);
309 result_array[3] =
static_cast<uint8>(
x & 0xFF);
313 #if PROTOBUF_USE_EXCEPTIONS
314 FatalException::~FatalException() throw() {}
316 const char* FatalException::what()
const throw() {
317 return message_.c_str();
324 #include <google/protobuf/port_undef.inc>
void NullLogHandler(LogLevel, const char *, int, const std::string &)
const Descriptor::ReservedRange value
std::string ToString(StatusToStringMode mode=StatusToStringMode::kDefault) const
void VerifyVersion(int headerVersion, int minLibraryVersion, const char *filename)
void NullLogHandler(LogLevel, const char *, int, const string &)
DECLARE_STREAM_OPERATOR(long) DECLARE_STREAM_OPERATOR(unsigned long) DECLARE_STREAM_OPERATOR(long long) DECLARE_STREAM_OPERATOR(unsigned long long) LogMessage
#define GOOGLE_PROTOBUF_VERSION
static const int kMinHeaderVersionForLibrary
_W64 unsigned int uintptr_t
string VersionString(int version)
double Finish(Counter const &c, IterationCount iterations, double cpu_time, double num_threads)
LogHandler * SetLogHandler(LogHandler *new_func)
GRPC_CUSTOM_UTIL_STATUS Status
#define GOOGLE_PROTOBUF_MIN_LOG_LEVEL
static std::atomic< int > log_silencer_count_
#define GOOGLE_LOG(LEVEL)
void LogHandler(LogLevel level, const char *filename, int line, const std::string &message)
LogMessage(LogLevel level, const char *filename, int line)
static LogHandler * log_handler_
void DefaultLogHandler(LogLevel level, const char *filename, int line, const string &message)
static void DoNothing(void *, grpc_error_handle)
void StrAppend(string *result, const AlphaNum &a)
LogMessage & operator<<(const std::string &value)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:59