Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
c836ad4d
Commit
c836ad4d
authored
Dec 07, 2016
by
Adam Cozzette
Committed by
GitHub
Dec 07, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2459 from acozzette/android-logging
Send all protobuf logging to logcat by default on Android
parents
057389ca
2f29f0ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
common.cc
src/google/protobuf/stubs/common.cc
+11
-2
No files found.
src/google/protobuf/stubs/common.cc
View file @
c836ad4d
...
...
@@ -108,11 +108,17 @@ string VersionString(int version) {
// ===================================================================
// emulates google3/base/logging.cc
// If the minimum logging level is not set, we default to logging messages for
// all levels.
#ifndef GOOGLE_PROTOBUF_MIN_LOG_LEVEL
#define GOOGLE_PROTOBUF_MIN_LOG_LEVEL LOGLEVEL_INFO
#endif
namespace
internal
{
#if defined(__ANDROID__)
inline
void
DefaultLogHandler
(
LogLevel
level
,
const
char
*
filename
,
int
line
,
const
string
&
message
)
{
#ifdef GOOGLE_PROTOBUF_MIN_LOG_LEVEL
if
(
level
<
GOOGLE_PROTOBUF_MIN_LOG_LEVEL
)
{
return
;
}
...
...
@@ -143,11 +149,14 @@ inline void DefaultLogHandler(LogLevel level, const char* filename, int line,
__android_log_write
(
ANDROID_LOG_FATAL
,
"libprotobuf-native"
,
"terminating.
\n
"
);
}
#endif
}
#else
void
DefaultLogHandler
(
LogLevel
level
,
const
char
*
filename
,
int
line
,
const
string
&
message
)
{
if
(
level
<
GOOGLE_PROTOBUF_MIN_LOG_LEVEL
)
{
return
;
}
static
const
char
*
level_names
[]
=
{
"INFO"
,
"WARNING"
,
"ERROR"
,
"FATAL"
};
// We use fprintf() instead of cerr because we want this to work at static
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment