Destruct global objects in ShutdownGoogleLogging
http://code.google.com/p/google-glog/issues/detail?id=69 git-svn-id: https://google-glog.googlecode.com/svn/trunk@96 eb4d4688-79bd-11dd-afb4-1d65580434c0
This commit is contained in:
parent
b1afbe7b3c
commit
c2cbc763ed
@ -311,8 +311,10 @@ class LogDestination {
|
||||
static const int kNetworkBytes = 1400;
|
||||
|
||||
static const string& hostname();
|
||||
private:
|
||||
|
||||
static void DeleteLogDestinations();
|
||||
|
||||
private:
|
||||
LogDestination(LogSeverity severity, const char* base_filename);
|
||||
~LogDestination() { }
|
||||
|
||||
@ -607,6 +609,13 @@ inline LogDestination* LogDestination::log_destination(LogSeverity severity) {
|
||||
return log_destinations_[severity];
|
||||
}
|
||||
|
||||
void LogDestination::DeleteLogDestinations() {
|
||||
for (int severity = 0; severity < NUM_SEVERITIES; ++severity) {
|
||||
delete log_destinations_[severity];
|
||||
log_destinations_[severity] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
LogFileObject::LogFileObject(LogSeverity severity,
|
||||
@ -1779,4 +1788,15 @@ LogMessageFatal::~LogMessageFatal() {
|
||||
LogMessage::Fail();
|
||||
}
|
||||
|
||||
void InitGoogleLogging(const char* argv0) {
|
||||
glog_internal_namespace_::InitGoogleLoggingUtilities(argv0);
|
||||
}
|
||||
|
||||
void ShutdownGoogleLogging() {
|
||||
glog_internal_namespace_::ShutdownGoogleLoggingUtilities();
|
||||
LogDestination::DeleteLogDestinations();
|
||||
delete logging_directories_list;
|
||||
logging_directories_list = NULL;
|
||||
}
|
||||
|
||||
_END_GOOGLE_NAMESPACE_
|
||||
|
||||
@ -311,9 +311,7 @@ void SetCrashReason(const CrashReason* r) {
|
||||
r);
|
||||
}
|
||||
|
||||
} // namespace glog_internal_namespace_
|
||||
|
||||
void InitGoogleLogging(const char* argv0) {
|
||||
void InitGoogleLoggingUtilities(const char* argv0) {
|
||||
CHECK(!IsGoogleLoggingInitialized())
|
||||
<< "You called InitGoogleLogging() twice!";
|
||||
const char* slash = strrchr(argv0, '/');
|
||||
@ -328,7 +326,7 @@ void InitGoogleLogging(const char* argv0) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void ShutdownGoogleLogging() {
|
||||
void ShutdownGoogleLoggingUtilities() {
|
||||
CHECK(IsGoogleLoggingInitialized())
|
||||
<< "You called ShutdownGoogleLogging() without calling InitGoogleLogging() first!";
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
@ -336,6 +334,8 @@ void ShutdownGoogleLogging() {
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace glog_internal_namespace_
|
||||
|
||||
_END_GOOGLE_NAMESPACE_
|
||||
|
||||
// Make an implementation of stacktrace compiled.
|
||||
|
||||
@ -214,6 +214,9 @@ struct CrashReason {
|
||||
|
||||
void SetCrashReason(const CrashReason* r);
|
||||
|
||||
void InitGoogleLoggingUtilities(const char* argv0);
|
||||
void ShutdownGoogleLoggingUtilities();
|
||||
|
||||
} // namespace glog_internal_namespace_
|
||||
|
||||
_END_GOOGLE_NAMESPACE_
|
||||
|
||||
Loading…
Reference in New Issue
Block a user