From 585d7f9f28c88a8d32dd8166618203fefd0254e7 Mon Sep 17 00:00:00 2001 From: Yohei Kitamura Date: Thu, 19 Sep 2024 22:42:10 +0900 Subject: [PATCH] Reorder fields to have the `data` field before the `exception` field --- .github/workflows/build.yml | 17 +++++++++++------ CHANGELOG.md | 3 +++ lib/lorekeeper/json_logger.rb | 3 ++- lib/lorekeeper/version.rb | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eb5d8f0..8cb754a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,18 +15,23 @@ jobs: strategy: matrix: ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] - rails: ['5.2.7', '6.0.4', '6.1.7', '7.0.8', '7.1.1'] + rails: ['5.2.8', '6.0.6', '6.1.7', '7.0.8', '7.1.4', '7.2.1'] include: - - rails: '4.0.1' + - rails: '4.0.13' ruby: '2.7' - - rails: '4.1.1' + - rails: '4.1.16' ruby: '2.7' - - rails: '4.2.1' + - rails: '4.2.11' ruby: '2.7' - - rails: '5.0.1' + - rails: '5.0.7' ruby: '2.7' - - rails: '5.1.1' + - rails: '5.1.7' ruby: '2.7' + exclude: + - rails: '7.2.1' + ruby: '2.7' + - rails: '7.2.1' + ruby: '3.0' steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d58b0..942665c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.6.4 +* Reorder fields to have the `data` field before the `exception` field + # 2.6.3 * Fix Lorekeeper::BacktraceCleaner to support BacktraceLocation diff --git a/lib/lorekeeper/json_logger.rb b/lib/lorekeeper/json_logger.rb index 16c4636..ad355bf 100644 --- a/lib/lorekeeper/json_logger.rb +++ b/lib/lorekeeper/json_logger.rb @@ -77,10 +77,11 @@ def exception(exception, custom_message = nil, custom_data = nil, custom_level = if exception.is_a?(Exception) backtrace = clean_backtrace(exception.backtrace || []) exception_fields = { + DATA => param_data, EXCEPTION => "#{exception.class}: #{exception.message}", STACK => backtrace } - exception_fields[DATA] = param_data if param_data + exception_fields.compact! message = param_message || exception.message with_extra_fields(exception_fields) { log_data(log_level, message) } diff --git a/lib/lorekeeper/version.rb b/lib/lorekeeper/version.rb index 0a2654b..d247b50 100644 --- a/lib/lorekeeper/version.rb +++ b/lib/lorekeeper/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Lorekeeper - VERSION = '2.6.3' + VERSION = '2.6.4' end