From 8f81fae116b449ef17561c3574d01574544c798c Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 29 Jun 2020 10:20:51 -0600 Subject: showTrace flag in loggers --- src/libutil/logging.hh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/libutil/logging.hh') diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh index b1583eced..3c164c670 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -75,6 +75,9 @@ public: logEI(ei); } + virtual bool getShowTrace() const = 0; + virtual void setShowTrace(bool showTrace) = 0; + virtual void warn(const std::string & msg); virtual void startActivity(ActivityId act, Verbosity lvl, ActivityType type, @@ -146,7 +149,8 @@ struct PushActivity extern Logger * logger; -Logger * makeSimpleLogger(bool printBuildLogs = true); +Logger * makeSimpleLogger(bool printBuildLogs, bool showTrace); +// Logger * makeSimpleLogger(bool printBuildLogs = true, bool showTrace); Logger * makeJSONLogger(Logger & prevLogger); -- cgit v1.2.3 From 9159dfe3d8053e0c77d32893e45f8c527ba83076 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Tue, 30 Jun 2020 16:31:55 -0600 Subject: comments and cleanup --- src/libutil/logging.hh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/libutil/logging.hh') diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh index 3c164c670..273300b50 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -149,8 +149,7 @@ struct PushActivity extern Logger * logger; -Logger * makeSimpleLogger(bool printBuildLogs, bool showTrace); -// Logger * makeSimpleLogger(bool printBuildLogs = true, bool showTrace); +Logger * makeSimpleLogger(bool printBuildLogs = true, bool showTrace = false); Logger * makeJSONLogger(Logger & prevLogger); -- cgit v1.2.3 From bf2788e4c1d92a8d625f016b2a3b4d34990f33e3 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Thu, 2 Jul 2020 09:04:31 -0600 Subject: move showTrace to new loggerSettings --- src/libutil/logging.hh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/libutil/logging.hh') diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh index 273300b50..09619aac6 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -2,6 +2,7 @@ #include "types.hh" #include "error.hh" +#include "config.hh" namespace nix { @@ -34,6 +35,16 @@ typedef enum { typedef uint64_t ActivityId; +struct LoggerSettings : Config +{ + Setting showTrace{this, + false, + "show-trace", + "Whether to show a stack trace on evaluation errors."}; +}; + +extern LoggerSettings loggerSettings; + class Logger { friend struct Activity; @@ -75,9 +86,6 @@ public: logEI(ei); } - virtual bool getShowTrace() const = 0; - virtual void setShowTrace(bool showTrace) = 0; - virtual void warn(const std::string & msg); virtual void startActivity(ActivityId act, Verbosity lvl, ActivityType type, @@ -149,7 +157,7 @@ struct PushActivity extern Logger * logger; -Logger * makeSimpleLogger(bool printBuildLogs = true, bool showTrace = false); +Logger * makeSimpleLogger(bool printBuildLogs = true); Logger * makeJSONLogger(Logger & prevLogger); -- cgit v1.2.3