#include "utilities.h"#include <algorithm>#include <cassert>#include <iomanip>#include <string>#include <climits>#include <sys/types.h>#include <sys/stat.h>#include <ctime>#include <fcntl.h>#include <cstdio>#include <iostream>#include <cstdarg>#include <cstdlib>#include <vector>#include <cerrno>#include <sstream>#include <dirent.h>#include "base/commandlineflags.h"#include <glog/logging.h>#include <glog/raw_logging.h>#include "base/googleinit.h"
Go to the source code of this file.
Classes | |
| class | LogDestination |
| struct | LogMessage::LogMessageData |
Namespaces | |
| base | |
| base::internal | |
Macros | |
| #define | _GNU_SOURCE 1 |
| #define | DEFINE_CHECK_STROP_IMPL(name, func, expected) |
| #define | EXCLUSIVE_LOCKS_REQUIRED(mu) |
| #define | PATH_SEPARATOR '/' |
Enumerations | |
| enum | GLogColor { COLOR_DEFAULT, COLOR_RED, COLOR_GREEN, COLOR_YELLOW } |
Functions | |
| void | AddLogSink (LogSink *destination) |
| static bool | BoolFromEnv (const char *varname, bool defval) |
| static void | ColoredWriteToStderr (LogSeverity severity, const char *message, size_t len) |
| static void | ColoredWriteToStderrOrStdout (FILE *output, LogSeverity severity, const char *message, size_t len) |
| static void | ColoredWriteToStdout (LogSeverity severity, const char *message, size_t len) |
| static const char * | DefaultLogDir () |
| DEFINE_int32 (stderrthreshold, GOOGLE_NAMESPACE::GLOG_ERROR, "log messages at or above this level are copied to stderr in " "addition to logfiles. This flag obsoletes --alsologtostderr.") | |
| void | DisableLogCleaner () |
| void | EnableLogCleaner (unsigned int overdue_days) |
| void | FlushLogFiles (LogSeverity min_severity) |
| void | FlushLogFilesUnsafe (LogSeverity min_severity) |
| static const char * | GetAnsiColorCode (GLogColor color) |
| void | GetExistingTempDirectories (vector< string > *list) |
| bool | base::internal::GetExitOnDFatal () |
| static void | GetHostName (string *hostname) |
| const vector< string > & | GetLoggingDirectories () |
| const char * | GetLogSeverityName (LogSeverity severity) |
| static void | GetTempDirectories (vector< string > *list) |
| GLOG_DEFINE_bool (alsologtostderr, BoolFromEnv("GOOGLE_ALSOLOGTOSTDERR", false), "log messages go to stderr in addition to logfiles") | |
| GLOG_DEFINE_bool (colorlogtostderr, false, "color messages logged to stderr (if supported by terminal)") | |
| GLOG_DEFINE_bool (colorlogtostdout, false, "color messages logged to stdout (if supported by terminal)") | |
| GLOG_DEFINE_bool (log_prefix, true, "Prepend the log prefix to the start of each log line") | |
| GLOG_DEFINE_bool (log_utc_time, false, "Use UTC time for logging.") | |
| GLOG_DEFINE_bool (log_year_in_prefix, true, "Include the year in the log prefix") | |
| GLOG_DEFINE_bool (logtostderr, BoolFromEnv("GOOGLE_LOGTOSTDERR", false), "log messages go to stderr instead of logfiles") | |
| GLOG_DEFINE_bool (logtostdout, BoolFromEnv("GOOGLE_LOGTOSTDOUT", false), "log messages go to stdout instead of logfiles") | |
| GLOG_DEFINE_bool (stop_logging_if_full_disk, false, "Stop attempting to log to disk if the disk is full.") | |
| GLOG_DEFINE_bool (timestamp_in_logfile_name, BoolFromEnv("GOOGLE_TIMESTAMP_IN_LOGFILE_NAME", true), "put a timestamp at the end of the log file name") | |
| GLOG_DEFINE_int32 (logbuflevel, 0, "Buffer log messages logged at this level or lower" " (-1 means don't buffer; 0 means buffer INFO only;" " ...)") | |
| GLOG_DEFINE_int32 (logbufsecs, 30, "Buffer log messages for at most this many seconds") | |
| GLOG_DEFINE_int32 (logcleansecs, 60 *5, "Clean overdue logs every this many seconds") | |
| GLOG_DEFINE_int32 (logemaillevel, 999, "Email log messages logged at this level or higher" " (0 means email all; 3 means email FATAL only;" " ...)") | |
| GLOG_DEFINE_int32 (logfile_mode, 0664, "Log file mode/permissions.") | |
| GLOG_DEFINE_int32 (minloglevel, 0, "Messages logged at a lower level than this don't " "actually get logged anywhere") | |
| GLOG_DEFINE_string (alsologtoemail, "", "log messages go to these email addresses " "in addition to logfiles") | |
| GLOG_DEFINE_string (log_backtrace_at, "", "Emit a backtrace when logging at file:linenum.") | |
| GLOG_DEFINE_string (log_dir, DefaultLogDir(), "If specified, logfiles are written into this directory instead " "of the default logging directory.") | |
| GLOG_DEFINE_string (log_link, "", "Put additional links to the log " "files in this directory") | |
| GLOG_DEFINE_string (logmailer, "", "Mailer used to send logging email") | |
| GLOG_DEFINE_uint32 (max_log_size, 1800, "approx. maximum log file size (in MB). A value of 0 will " "be silently overridden to 1.") | |
| void | InitGoogleLogging (const char *argv0) |
| void | InstallFailureFunction (logging_fail_func_t fail_func) |
| void | LogToStderr () |
| template<> | |
| void | MakeCheckOpValueString (std::ostream *os, const char &v) |
| template<> | |
| void | MakeCheckOpValueString (std::ostream *os, const signed char &v) |
| template<> | |
| void | MakeCheckOpValueString (std::ostream *os, const unsigned char &v) |
| static uint32 | MaxLogSize () |
| ostream & | operator<< (ostream &os, const PRIVATE_Counter &) |
| int | posix_strerror_r (int err, char *buf, size_t len) |
| static ssize_t | pread (int fd, void *buf, size_t count, off_t offset) |
| static ssize_t | pwrite (int fd, void *buf, size_t count, off_t offset) |
| void | RemoveLogSink (LogSink *destination) |
| void | ReprintFatalMessage () |
| bool | SendEmail (const char *dest, const char *subject, const char *body) |
| static bool | SendEmailInternal (const char *dest, const char *subject, const char *body, bool use_logging) |
| void | SetApplicationFingerprint (const std::string &fingerprint) |
| void | SetEmailLogging (LogSeverity min_severity, const char *addresses) |
| void | base::internal::SetExitOnDFatal (bool value) |
| void | SetLogDestination (LogSeverity severity, const char *base_filename) |
| void | SetLogFilenameExtension (const char *ext) |
| void | SetLogSymlink (LogSeverity severity, const char *symlink_basename) |
| void | SetStderrLogging (LogSeverity min_severity) |
| static GLogColor | SeverityToColor (LogSeverity severity) |
| static string | ShellEscape (const string &src) |
| void | ShutdownGoogleLogging () |
| string | StrError (int err) |
| static bool | TerminalSupportsColor () |
| void | TestOnly_ClearLoggingDirectoriesList () |
| void | TruncateLogFile (const char *path, uint64 limit, uint64 keep) |
| void | TruncateStdoutStderr () |
| static void | WriteToStderr (const char *message, size_t len) |
Variables | |
| static CrashReason | crash_reason |
| static bool | exit_on_dfatal = true |
| static char | fatal_message [256] |
| static LogMessage::LogMessageData | fatal_msg_data_exclusive |
| static LogMessage::LogMessageData | fatal_msg_data_shared |
| static bool | fatal_msg_exclusive = true |
| static Mutex | fatal_msg_lock |
| static time_t | fatal_time |
| GLOG_EXPORT logging_fail_func_t | g_logging_fail_func |
| static const char | kDontNeedShellEscapeChars [] |
| static Mutex | log_mutex |
| static vector< string > * | logging_directories_list |
| const char *const | LogSeverityNames [NUM_SEVERITIES] |
| static bool | stop_writing = false |
| #define _GNU_SOURCE 1 |
Definition at line 30 of file logging.cc.
Definition at line 2471 of file logging.cc.
| #define EXCLUSIVE_LOCKS_REQUIRED | ( | mu | ) |
Definition at line 106 of file logging.cc.
| #define PATH_SEPARATOR '/' |
Definition at line 208 of file logging.cc.
| enum GLogColor |
| Enumerator | |
|---|---|
| COLOR_DEFAULT | |
| COLOR_RED | |
| COLOR_GREEN | |
| COLOR_YELLOW | |
Definition at line 297 of file logging.cc.
| void AddLogSink | ( | LogSink * | destination | ) |
Definition at line 2138 of file logging.cc.
|
static |
Definition at line 108 of file logging.cc.
|
static |
Definition at line 798 of file logging.cc.
|
static |
Definition at line 746 of file logging.cc.
|
static |
Definition at line 787 of file logging.cc.
|
static |
Definition at line 173 of file logging.cc.
| DEFINE_int32 | ( | stderrthreshold | , |
| GOOGLE_NAMESPACE::GLOG_ERROR | , | ||
| "log messages at or above this level are copied to stderr in " "addition to logfiles. This flag obsoletes --alsologtostderr." | |||
| ) |
| void DisableLogCleaner | ( | ) |
Definition at line 2643 of file logging.cc.
| void EnableLogCleaner | ( | unsigned int | overdue_days | ) |
Definition at line 2639 of file logging.cc.
| void FlushLogFiles | ( | LogSeverity | min_severity | ) |
Definition at line 2059 of file logging.cc.
| void FlushLogFilesUnsafe | ( | LogSeverity | min_severity | ) |
Definition at line 2063 of file logging.cc.
|
static |
Definition at line 340 of file logging.cc.
Definition at line 2366 of file logging.cc.
Definition at line 246 of file logging.cc.
| const vector<string>& GetLoggingDirectories | ( | ) |
Definition at line 2336 of file logging.cc.
| const char* GetLogSeverityName | ( | LogSeverity | severity | ) |
Definition at line 411 of file logging.cc.
Definition at line 2285 of file logging.cc.
| GLOG_DEFINE_bool | ( | alsologtostderr | , |
| BoolFromEnv("GOOGLE_ALSOLOGTOSTDERR", false) | , | ||
| "log messages go to stderr in addition to logfiles" | |||
| ) |
| GLOG_DEFINE_bool | ( | colorlogtostderr | , |
| false | , | ||
| "color messages logged to stderr (if supported by terminal)" | |||
| ) |
| GLOG_DEFINE_bool | ( | colorlogtostdout | , |
| false | , | ||
| "color messages logged to stdout (if supported by terminal)" | |||
| ) |
| GLOG_DEFINE_bool | ( | logtostderr | , |
| BoolFromEnv("GOOGLE_LOGTOSTDERR", false) | , | ||
| "log messages go to stderr instead of logfiles" | |||
| ) |
| GLOG_DEFINE_bool | ( | logtostdout | , |
| BoolFromEnv("GOOGLE_LOGTOSTDOUT", false) | , | ||
| "log messages go to stdout instead of logfiles" | |||
| ) |
| GLOG_DEFINE_bool | ( | stop_logging_if_full_disk | , |
| false | , | ||
| "Stop attempting to log to disk if the disk is full." | |||
| ) |
| GLOG_DEFINE_bool | ( | timestamp_in_logfile_name | , |
| BoolFromEnv("GOOGLE_TIMESTAMP_IN_LOGFILE_NAME", true) | , | ||
| "put a timestamp at the end of the log file name" | |||
| ) |
| GLOG_DEFINE_int32 | ( | logbuflevel | , |
| 0 | , | ||
| "Buffer log messages logged at this level or lower" " (-1 means don't buffer; 0 means buffer INFO only;" " ...)" | |||
| ) |
| GLOG_DEFINE_int32 | ( | logbufsecs | , |
| 30 | , | ||
| "Buffer log messages for at most this many seconds" | |||
| ) |
| GLOG_DEFINE_int32 | ( | logcleansecs | , |
| 60 * | 5, | ||
| "Clean overdue logs every this many seconds" | |||
| ) |
| GLOG_DEFINE_int32 | ( | logemaillevel | , |
| 999 | , | ||
| "Email log messages logged at this level or higher" " (0 means email all; 3 means email FATAL only;" " ...)" | |||
| ) |
| GLOG_DEFINE_int32 | ( | logfile_mode | , |
| 0664 | , | ||
| "Log file mode/permissions." | |||
| ) |
| GLOG_DEFINE_int32 | ( | minloglevel | , |
| 0 | , | ||
| "Messages logged at a lower level than this don't " "actually get logged anywhere" | |||
| ) |
| GLOG_DEFINE_string | ( | alsologtoemail | , |
| "" | , | ||
| "log messages go to these email addresses " "in addition to logfiles" | |||
| ) |
| GLOG_DEFINE_string | ( | log_backtrace_at | , |
| "" | , | ||
| "Emit a backtrace when logging at file:linenum." | |||
| ) |
| GLOG_DEFINE_string | ( | log_dir | , |
| DefaultLogDir() | , | ||
| "If | specified, | ||
| logfiles are written into this directory instead " "of the default logging directory." | |||
| ) |
| GLOG_DEFINE_string | ( | log_link | , |
| "" | , | ||
| "Put additional links to the log " "files in this directory" | |||
| ) |
| GLOG_DEFINE_string | ( | logmailer | , |
| "" | , | ||
| "Mailer used to send logging email" | |||
| ) |
| GLOG_DEFINE_uint32 | ( | max_log_size | , |
| 1800 | , | ||
| "approx. maximum log file size (in MB). A value of 0 will " "be silently overridden to 1." | |||
| ) |
| void InitGoogleLogging | ( | const char * | argv0 | ) |
Definition at line 2618 of file logging.cc.
| void InstallFailureFunction | ( | logging_fail_func_t | fail_func | ) |
Definition at line 1941 of file logging.cc.
| void LogToStderr | ( | ) |
Definition at line 2158 of file logging.cc.
| void MakeCheckOpValueString | ( | std::ostream * | os, |
| const char & | v | ||
| ) |
Definition at line 2585 of file logging.cc.
| void MakeCheckOpValueString | ( | std::ostream * | os, |
| const signed char & | v | ||
| ) |
Definition at line 2594 of file logging.cc.
| void MakeCheckOpValueString | ( | std::ostream * | os, |
| const unsigned char & | v | ||
| ) |
Definition at line 2603 of file logging.cc.
|
static |
Definition at line 353 of file logging.cc.
| ostream& operator<< | ( | ostream & | os, |
| const PRIVATE_Counter & | |||
| ) |
Definition at line 2035 of file logging.cc.
| int posix_strerror_r | ( | int | err, |
| char * | buf, | ||
| size_t | len | ||
| ) |
Definition at line 2490 of file logging.cc.
|
static |
Definition at line 215 of file logging.cc.
|
static |
Definition at line 231 of file logging.cc.
| void RemoveLogSink | ( | LogSink * | destination | ) |
Definition at line 2142 of file logging.cc.
| void ReprintFatalMessage | ( | ) |
Definition at line 1808 of file logging.cc.
| bool SendEmail | ( | const char * | dest, |
| const char * | subject, | ||
| const char * | body | ||
| ) |
Definition at line 2281 of file logging.cc.
|
static |
Definition at line 2229 of file logging.cc.
| void SetApplicationFingerprint | ( | const std::string & | fingerprint | ) |
Definition at line 941 of file logging.cc.
| void SetEmailLogging | ( | LogSeverity | min_severity, |
| const char * | addresses | ||
| ) |
Definition at line 2154 of file logging.cc.
| void SetLogDestination | ( | LogSeverity | severity, |
| const char * | base_filename | ||
| ) |
Definition at line 2067 of file logging.cc.
| void SetLogFilenameExtension | ( | const char * | ext | ) |
Definition at line 2146 of file logging.cc.
| void SetLogSymlink | ( | LogSeverity | severity, |
| const char * | symlink_basename | ||
| ) |
Definition at line 2071 of file logging.cc.
| void SetStderrLogging | ( | LogSeverity | min_severity | ) |
Definition at line 2150 of file logging.cc.
|
static |
Definition at line 304 of file logging.cc.
Definition at line 2196 of file logging.cc.
| void ShutdownGoogleLogging | ( | ) |
Definition at line 2632 of file logging.cc.
| string StrError | ( | int | err | ) |
Definition at line 2540 of file logging.cc.
|
static |
Definition at line 269 of file logging.cc.
| void TestOnly_ClearLoggingDirectoriesList | ( | ) |
Definition at line 2359 of file logging.cc.
| void TruncateLogFile | ( | const char * | path, |
| uint64 | limit, | ||
| uint64 | keep | ||
| ) |
Definition at line 2380 of file logging.cc.
| void TruncateStdoutStderr | ( | ) |
Definition at line 2458 of file logging.cc.
|
static |
Definition at line 803 of file logging.cc.
|
static |
Definition at line 1535 of file logging.cc.
|
static |
Definition at line 409 of file logging.cc.
|
static |
Definition at line 1806 of file logging.cc.
|
static |
Definition at line 1537 of file logging.cc.
|
static |
Definition at line 1538 of file logging.cc.
|
static |
Definition at line 1536 of file logging.cc.
|
static |
Definition at line 1534 of file logging.cc.
|
static |
Definition at line 1805 of file logging.cc.
| GLOG_EXPORT logging_fail_func_t g_logging_fail_func |
Definition at line 1938 of file logging.cc.
|
static |
Definition at line 2191 of file logging.cc.
|
static |
Definition at line 396 of file logging.cc.
|
static |
Definition at line 2334 of file logging.cc.
| const char* const LogSeverityNames[NUM_SEVERITIES] |
Definition at line 404 of file logging.cc.
|
static |
Definition at line 402 of file logging.cc.