Merge pull request #400 from guoyuhong/fixWebmailer

Fix logmailer problem for dynamic lib use of glog.
This commit is contained in:
Sergiu Deitsch 2021-02-13 11:57:07 +01:00 committed by GitHub
commit 4fa737b62a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,7 +156,7 @@ GLOG_DEFINE_int32(logemaillevel, 999,
"Email log messages logged at this level or higher" "Email log messages logged at this level or higher"
" (0 means email all; 3 means email FATAL only;" " (0 means email all; 3 means email FATAL only;"
" ...)"); " ...)");
GLOG_DEFINE_string(logmailer, "/bin/mail", GLOG_DEFINE_string(logmailer, "",
"Mailer used to send logging email"); "Mailer used to send logging email");
// Compute the default value for --log_dir // Compute the default value for --log_dir
@ -2139,8 +2139,12 @@ static bool SendEmailInternal(const char*dest, const char *subject,
subject, body, dest); subject, body, dest);
} }
string logmailer = FLAGS_logmailer;
if (logmailer.empty()) {
logmailer = "/bin/mail";
}
string cmd = string cmd =
FLAGS_logmailer + " -s" + logmailer + " -s" +
ShellEscape(subject) + " " + ShellEscape(dest); ShellEscape(subject) + " " + ShellEscape(dest);
VLOG(4) << "Mailing command: " << cmd; VLOG(4) << "Mailing command: " << cmd;