Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
G
glog
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
glog
Commits
460ec1f5
Commit
460ec1f5
authored
Feb 14, 2019
by
Shinichiro Hamaji
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into release-0-4-0
parents
ed1ef7c4
41f4bf9c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
30 deletions
+15
-30
README.md
README.md
+1
-1
raw_logging.h.in
src/glog/raw_logging.h.in
+0
-5
logging.cc
src/logging.cc
+0
-1
logging_unittest.cc
src/logging_unittest.cc
+4
-3
raw_logging.cc
src/raw_logging.cc
+1
-15
stacktrace_unittest.cc
src/stacktrace_unittest.cc
+9
-0
raw_logging.h
src/windows/glog/raw_logging.h
+0
-5
No files found.
README.md
View file @
460ec1f5
[
![Build Status
](
https://img.shields.io/travis/google/glog/master.svg?label=Travis
)
](https://travis-ci.org/google/glog/builds)
[
![Grunt status
](
https://img.shields.io/appveyor/ci/google
/glog/master.svg?label=Appveyor
)
](https://ci.appveyor.com/project/google
/glog/history)
[
![Grunt status
](
https://img.shields.io/appveyor/ci/google
-admin/glog/master.svg?label=Appveyor
)
](https://ci.appveyor.com/project/google-admin
/glog/history)
This repository contains a C++ implementation of the Google logging
module. Documentation for the implementation is in doc/.
...
...
src/glog/raw_logging.h.in
View file @
460ec1f5
...
...
@@ -175,11 +175,6 @@ GOOGLE_GLOG_DLL_DECL void RawLog__(LogSeverity severity,
const char* format, ...)
@ac_cv___attribute___printf_4_5@;
// Hack to propagate time information into this module so that
// this module does not have to directly call localtime_r(),
// which could allocate memory.
GOOGLE_GLOG_DLL_DECL void RawLog__SetLastTime(const struct tm& t, int usecs);
@ac_google_end_namespace@
#endif // BASE_RAW_LOGGING_H_
src/logging.cc
View file @
460ec1f5
...
...
@@ -1266,7 +1266,6 @@ void LogMessage::Init(const char* file,
data_
->
timestamp_
=
static_cast
<
time_t
>
(
now
);
localtime_r
(
&
data_
->
timestamp_
,
&
data_
->
tm_time_
);
int
usecs
=
static_cast
<
int
>
((
now
-
data_
->
timestamp_
)
*
1000000
);
RawLog__SetLastTime
(
data_
->
tm_time_
,
usecs
);
data_
->
num_chars_to_log_
=
0
;
data_
->
num_chars_to_syslog_
=
0
;
...
...
src/logging_unittest.cc
View file @
460ec1f5
...
...
@@ -572,9 +572,10 @@ void TestDCHECK() {
DCHECK_GT
(
2
,
1
);
DCHECK_LT
(
1
,
2
);
auto_ptr
<
int64
>
sptr
(
new
int64
);
int64
*
ptr
=
DCHECK_NOTNULL
(
sptr
.
get
());
CHECK_EQ
(
ptr
,
sptr
.
get
());
int64
*
orig_ptr
=
new
int64
;
int64
*
ptr
=
DCHECK_NOTNULL
(
orig_ptr
);
CHECK_EQ
(
ptr
,
orig_ptr
);
delete
orig_ptr
;
}
void
TestSTREQ
()
{
...
...
src/raw_logging.cc
View file @
460ec1f5
...
...
@@ -68,17 +68,6 @@
_START_GOOGLE_NAMESPACE_
// Data for RawLog__ below. We simply pick up the latest
// time data created by a normal log message to avoid calling
// localtime_r which can allocate memory.
static
struct
::
tm
last_tm_time_for_raw_log
;
static
int
last_usecs_for_raw_log
;
void
RawLog__SetLastTime
(
const
struct
::
tm
&
t
,
int
usecs
)
{
memcpy
(
&
last_tm_time_for_raw_log
,
&
t
,
sizeof
(
last_tm_time_for_raw_log
));
last_usecs_for_raw_log
=
usecs
;
}
// CAVEAT: vsnprintf called from *DoRawLog below has some (exotic) code paths
// that invoke malloc() and getenv() that might acquire some locks.
// If this becomes a problem we should reimplement a subset of vsnprintf
...
...
@@ -120,16 +109,13 @@ void RawLog__(LogSeverity severity, const char* file, int line,
return
;
// this stderr log message is suppressed
}
// can't call localtime_r here: it can allocate
struct
::
tm
&
t
=
last_tm_time_for_raw_log
;
char
buffer
[
kLogBufSize
];
char
*
buf
=
buffer
;
int
size
=
sizeof
(
buffer
);
// NOTE: this format should match the specification in base/logging.h
DoRawLog
(
&
buf
,
&
size
,
"%c
%02d%02d %02d:%02d:%02d.%06d
%5u %s:%d] RAW: "
,
DoRawLog
(
&
buf
,
&
size
,
"%c
0000 00:00:00.000000
%5u %s:%d] RAW: "
,
LogSeverityNames
[
severity
][
0
],
1
+
t
.
tm_mon
,
t
.
tm_mday
,
t
.
tm_hour
,
t
.
tm_min
,
t
.
tm_sec
,
last_usecs_for_raw_log
,
static_cast
<
unsigned
int
>
(
GetTID
()),
const_basename
(
const_cast
<
char
*>
(
file
)),
line
);
...
...
src/stacktrace_unittest.cc
View file @
460ec1f5
...
...
@@ -180,6 +180,15 @@ static void ATTRIBUTE_NOINLINE CheckStackTrace1(int i) {
CheckStackTrace2
(
j
);
DECLARE_ADDRESS_LABEL
(
end
);
}
#ifndef __GNUC__
// On non-GNU environment, we use the address of `CheckStackTrace` to
// guess the address range of this function. This guess is wrong for
// non-static function on Windows. This is probably because
// `&CheckStackTrace` returns the address of a trampoline like PLT,
// not the actual address of `CheckStackTrace`.
// See https://github.com/google/glog/issues/421 for the detail.
static
#endif
void
ATTRIBUTE_NOINLINE
CheckStackTrace
(
int
i
)
{
INIT_ADDRESS_RANGE
(
CheckStackTrace
,
start
,
end
,
&
expected_range
[
5
]);
DECLARE_ADDRESS_LABEL
(
start
);
...
...
src/windows/glog/raw_logging.h
View file @
460ec1f5
...
...
@@ -179,11 +179,6 @@ GOOGLE_GLOG_DLL_DECL void RawLog__(LogSeverity severity,
const
char
*
format
,
...)
;
// Hack to propagate time information into this module so that
// this module does not have to directly call localtime_r(),
// which could allocate memory.
GOOGLE_GLOG_DLL_DECL
void
RawLog__SetLastTime
(
const
struct
tm
&
t
,
int
usecs
);
}
#endif // BASE_RAW_LOGGING_H_
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