From d91b24723d8ba4201b13be2b735f0fdbc725847b Mon Sep 17 00:00:00 2001 From: johnfoconnor Date: Tue, 28 Jan 2020 14:04:18 -0800 Subject: [PATCH] version 8.0.2: add severity level for log sentry events (#152) * script to update version * version 8.0.2: add severity level for log sentry events --- docs/CHANGELOG.md | 4 +++ ixsentry/ixsentry/IXSentryClient.cpp | 11 +++++++ ixwebsocket/IXWebSocketVersion.h | 2 +- makefile | 3 ++ tools/update_version.sh | 45 ++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 1 deletion(-) create mode 100755 tools/update_version.sh diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 2dadb237..5d167e2c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All changes to this project will be documented in this file. +## [8.0.2] - 2020-01-28 + +Extract severity level when emitting messages to sentry + ## [8.0.1] - 2020-01-28 Fix bug #151 - If a socket connection is interrupted, calling stop() on the IXWebSocket object blocks until the next retry diff --git a/ixsentry/ixsentry/IXSentryClient.cpp b/ixsentry/ixsentry/IXSentryClient.cpp index e957efc6..e69dd72b 100644 --- a/ixsentry/ixsentry/IXSentryClient.cpp +++ b/ixsentry/ixsentry/IXSentryClient.cpp @@ -166,6 +166,17 @@ namespace ix tags.append(tag); } } + + if (msg["data"]["info"].isMember("level_str")) + { + // https://docs.sentry.io/enriching-error-data/context/?platform=python#setting-the-level + std::string level = msg["data"]["info"]["level_str"].asString(); + if (level == "critical") + { + level = "fatal"; + } + payload["level"] = level; + } } else { diff --git a/ixwebsocket/IXWebSocketVersion.h b/ixwebsocket/IXWebSocketVersion.h index 7852c3da..b23f42b8 100644 --- a/ixwebsocket/IXWebSocketVersion.h +++ b/ixwebsocket/IXWebSocketVersion.h @@ -6,4 +6,4 @@ #pragma once -#define IX_WEBSOCKET_VERSION "8.0.1" +#define IX_WEBSOCKET_VERSION "8.0.2" diff --git a/makefile b/makefile index 2ecdb9c9..d9f23fd5 100644 --- a/makefile +++ b/makefile @@ -49,6 +49,9 @@ BUILD := ${NAME}:build print_version: @echo 'IXWebSocket version =>' ${TAG} +set_version: + sh tools/update_version.sh ${VERSION} + docker_test: docker build -f docker/Dockerfile.debian -t bsergean/ixwebsocket_test:build . diff --git a/tools/update_version.sh b/tools/update_version.sh new file mode 100755 index 00000000..a1f164e6 --- /dev/null +++ b/tools/update_version.sh @@ -0,0 +1,45 @@ +#/bin/sh + +ver_gt() { + [ "$1" != "$2" ] && [ "$2" == "$(echo "$1\n$2" | sort -V | head -n1)" ] +} + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PROJECT_ROOT="$(dirname ${SCRIPT_DIR})" +CUR_VSN=$(bash $SCRIPT_DIR/extract_version.sh) +NEW_VSN="$1" + + +check_ver() { + if [[ $NEW_VSN =~ ^[0-9.]+$ ]]; then + : + else + echo "Invalid version '$NEW_VSN'" + exit 1 + fi +} + +check_ver_increase() { + if ! ver_gt $NEW_VSN $CUR_VSN; then + echo "Invalid version '$NEW_VSN'. Must be greater than current version $CUR_VSN" + exit 1 + fi +} + +check_changelog() { + if ! egrep "\b$NEW_VSN\b" $PROJECT_ROOT/docs/CHANGELOG.md >/dev/null; then + echo "Invalid version '$NEW_VSN'. Missing entry in CHANGELOG.md" + exit 1 + fi +} + +set_version() { + sed -i '' "s/$CUR_VSN/$NEW_VSN/g" $PROJECT_ROOT/ixwebsocket/IXWebSocketVersion.h + echo "Set version to '$NEW_VSN'" + exit 0 +} + +check_ver +check_ver_increase +check_changelog +set_version