Add ShutdownGoogleLogging to close syslog.
This patch was contributed by DGunchev (thanks!) http://code.google.com/p/google-glog/issues/detail?id=28 git-svn-id: https://google-glog.googlecode.com/svn/trunk@88 eb4d4688-79bd-11dd-afb4-1d65580434c0
This commit is contained in:
parent
b52f3fe2e4
commit
858a11d4e3
@ -482,6 +482,9 @@ DECLARE_bool(stop_logging_if_full_disk);
|
|||||||
// specified by argv0 in log outputs.
|
// specified by argv0 in log outputs.
|
||||||
GOOGLE_GLOG_DLL_DECL void InitGoogleLogging(const char* argv0);
|
GOOGLE_GLOG_DLL_DECL void InitGoogleLogging(const char* argv0);
|
||||||
|
|
||||||
|
// Shutdown google's logging library.
|
||||||
|
GOOGLE_GLOG_DLL_DECL void ShutdownGoogleLogging();
|
||||||
|
|
||||||
// Install a function which will be called after LOG(FATAL).
|
// Install a function which will be called after LOG(FATAL).
|
||||||
GOOGLE_GLOG_DLL_DECL void InstallFailureFunction(void (*fail_func)());
|
GOOGLE_GLOG_DLL_DECL void InstallFailureFunction(void (*fail_func)());
|
||||||
|
|
||||||
|
|||||||
@ -227,6 +227,8 @@ int main(int argc, char **argv) {
|
|||||||
TestErrno();
|
TestErrno();
|
||||||
TestTruncate();
|
TestTruncate();
|
||||||
|
|
||||||
|
ShutdownGoogleLogging();
|
||||||
|
|
||||||
fprintf(stdout, "PASS\n");
|
fprintf(stdout, "PASS\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,9 @@
|
|||||||
#elif defined(HAVE_SYS_SYSCALL_H)
|
#elif defined(HAVE_SYS_SYSCALL_H)
|
||||||
#include <sys/syscall.h> // for syscall()
|
#include <sys/syscall.h> // for syscall()
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_SYSLOG_H
|
||||||
|
# include <syslog.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "base/googleinit.h"
|
#include "base/googleinit.h"
|
||||||
|
|
||||||
@ -316,6 +319,14 @@ void InitGoogleLogging(const char* argv0) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShutdownGoogleLogging() {
|
||||||
|
CHECK(IsGoogleLoggingInitialized())
|
||||||
|
<< "You called ShutdownGoogleLogging() without InitGoogleLogging() first!";
|
||||||
|
#ifdef HAVE_SYSLOG_H
|
||||||
|
closelog();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
_END_GOOGLE_NAMESPACE_
|
_END_GOOGLE_NAMESPACE_
|
||||||
|
|
||||||
// Make an implementation of stacktrace compiled.
|
// Make an implementation of stacktrace compiled.
|
||||||
|
|||||||
@ -486,6 +486,9 @@ namespace google {
|
|||||||
// specified by argv0 in log outputs.
|
// specified by argv0 in log outputs.
|
||||||
GOOGLE_GLOG_DLL_DECL void InitGoogleLogging(const char* argv0);
|
GOOGLE_GLOG_DLL_DECL void InitGoogleLogging(const char* argv0);
|
||||||
|
|
||||||
|
// Shutdown google's logging library.
|
||||||
|
GOOGLE_GLOG_DLL_DECL void ShutdownGoogleLogging();
|
||||||
|
|
||||||
// Install a function which will be called after LOG(FATAL).
|
// Install a function which will be called after LOG(FATAL).
|
||||||
GOOGLE_GLOG_DLL_DECL void InstallFailureFunction(void (*fail_func)());
|
GOOGLE_GLOG_DLL_DECL void InstallFailureFunction(void (*fail_func)());
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user