diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2020-03-02 14:52:46 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-03-03 18:14:05 +0000 |
commit | 2803adc3ba76f87101d493cb940df4e0f53c7879 (patch) | |
tree | 73d5e0dbcf26bcff51fecc469b5e31d01c918585 /src/mongo/logv2/log_source.h | |
parent | a68774045ce42d55e82236408bd9cf004c54d12a (diff) | |
download | mongo-2803adc3ba76f87101d493cb940df4e0f53c7879.tar.gz |
SERVER-46520 Add mechanism to emit uassert as part of a logv2 log statement
Diffstat (limited to 'src/mongo/logv2/log_source.h')
-rw-r--r-- | src/mongo/logv2/log_source.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/logv2/log_source.h b/src/mongo/logv2/log_source.h index 99269bcdba2..7e389bd4548 100644 --- a/src/mongo/logv2/log_source.h +++ b/src/mongo/logv2/log_source.h @@ -63,12 +63,14 @@ public: _component(LogComponent::kDefault), _tags(LogTag::kNone), _truncation(constants::kDefaultTruncation), + _uassertErrorCode(ErrorCodes::OK), _id(-1) { add_attribute_unlocked(attributes::domain(), _domain); add_attribute_unlocked(attributes::severity(), _severity); add_attribute_unlocked(attributes::component(), _component); add_attribute_unlocked(attributes::tags(), _tags); add_attribute_unlocked(attributes::truncation(), _truncation); + add_attribute_unlocked(attributes::userassert(), _uassertErrorCode); add_attribute_unlocked(attributes::id(), _id); add_attribute_unlocked(attributes::timeStamp(), boost::log::attributes::make_function([]() { return Date_t::now(); @@ -85,13 +87,15 @@ public: LogSeverity severity, LogComponent component, LogTag tags, - LogTruncation truncation) { + LogTruncation truncation, + ErrorCodes::Error userassertErrorCode) { // Perform a quick check first if (this->core()->get_logging_enabled()) { _severity.set(severity); _component.set(component); _tags.set(tags); _truncation.set(truncation); + _uassertErrorCode.set(userassertErrorCode); _id.set(id); return Base::open_record_unlocked(); } else @@ -104,6 +108,7 @@ public: _component.set(LogComponent::kDefault); _tags.set(LogTag::kNone); _truncation.set(constants::kDefaultTruncation); + _uassertErrorCode.set(ErrorCodes::OK); _id.set(-1); } @@ -113,6 +118,7 @@ private: boost::log::attributes::mutable_constant<LogComponent> _component; boost::log::attributes::mutable_constant<LogTag> _tags; boost::log::attributes::mutable_constant<LogTruncation> _truncation; + boost::log::attributes::mutable_constant<ErrorCodes::Error> _uassertErrorCode; boost::log::attributes::mutable_constant<int32_t> _id; }; |