You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ya...@apache.org on 2017/05/17 00:38:22 UTC
mesos git commit: Use glog to log EXIT() messages.
Repository: mesos
Updated Branches:
refs/heads/master 91bd4d923 -> fff43d202
Use glog to log EXIT() messages.
Review: https://reviews.apache.org/r/56681/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fff43d20
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fff43d20
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fff43d20
Branch: refs/heads/master
Commit: fff43d202f23a26fd2c73b83989f3c03223f128b
Parents: 91bd4d9
Author: James Peach <jp...@apache.org>
Authored: Tue May 16 17:36:24 2017 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Tue May 16 17:36:24 2017 -0700
----------------------------------------------------------------------
3rdparty/stout/include/stout/exit.hpp | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/fff43d20/3rdparty/stout/include/stout/exit.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/exit.hpp b/3rdparty/stout/include/stout/exit.hpp
index 762864a..e5c2d34 100644
--- a/3rdparty/stout/include/stout/exit.hpp
+++ b/3rdparty/stout/include/stout/exit.hpp
@@ -15,39 +15,46 @@
#include <stdlib.h>
-#include <iostream> // For std::cerr.
#include <ostream>
-#include <sstream>
-#include <string>
+
+#include <glog/logging.h>
#include <stout/attributes.hpp>
-// Exit takes an exit status and provides a stream for output prior to
-// exiting. This is like glog's LOG(FATAL) or CHECK, except that it
-// does _not_ print a stack trace.
+// Exit takes an exit status and provides a glog stream for output
+// prior to exiting. This is like glog's LOG(FATAL) or CHECK, except
+// that it does _not_ print a stack trace.
//
// Ex: EXIT(EXIT_FAILURE) << "Cgroups are not present in this system.";
-#define EXIT(status) __Exit(status).stream()
+#define EXIT(status) __Exit(__FILE__, __LINE__, status).stream()
struct __Exit
{
- __Exit(int _status) : status(_status) {}
+ __Exit(const char* file, int line, int _status)
+ : status(_status),
+ message(
+ file,
+ line,
+ _status == EXIT_SUCCESS ? google::GLOG_INFO : google::GLOG_ERROR)
+ {
+ stream() << "EXIT with status " << _status << ": ";
+ }
NORETURN ~__Exit()
{
- std::cerr << out.str() << std::endl;
+ message.Flush();
exit(status);
}
std::ostream& stream()
{
- return out;
+ return message.stream();
}
- std::ostringstream out;
const int status;
+ google::LogMessage message;
};