From a75292c86f4040897d8622690d537f4a0f8d4d48 Mon Sep 17 00:00:00 2001 From: Better-Boy Date: Tue, 7 Oct 2025 01:46:04 +0000 Subject: [PATCH 1/6] added 'message' key as never type --- ballerina/natives.bal | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ballerina/natives.bal b/ballerina/natives.bal index e17c9165..acd55856 100644 --- a/ballerina/natives.bal +++ b/ballerina/natives.bal @@ -46,10 +46,12 @@ public type Valuer isolated function () returns anydata; # Key-Value pairs that needs to be displayed in the log. # # + msg - msg which cannot be a key +# + message - message which cannot be a key # + 'error - 'error which cannot be a key -# + stackTrace - error stack trace which cannot be a key +# + stackTrace - stackTrace which cannot be a key public type KeyValues record {| never msg?; + never message?; never 'error?; never stackTrace?; Value...; @@ -59,6 +61,8 @@ public type KeyValues record {| public type AnydataKeyValues record { # msg which cannot be a key never msg?; + # message which cannot be a key + never message?; # 'error which cannot be a key never 'error?; # stackTrace which cannot be a key From 8d81f65e88079b2d74d0fe3b878863cb0ef0e56f Mon Sep 17 00:00:00 2001 From: Better-Boy Date: Mon, 13 Oct 2025 11:05:59 +0000 Subject: [PATCH 2/6] added time and level as never type to KeyValue --- ballerina/natives.bal | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ballerina/natives.bal b/ballerina/natives.bal index 253eaf43..32b2c2e0 100644 --- a/ballerina/natives.bal +++ b/ballerina/natives.bal @@ -47,11 +47,15 @@ public type Valuer isolated function () returns anydata; # # + msg - msg which cannot be a key # + message - message which cannot be a key +# + time - time which cannot be a key +# + level - level which cannot be a key # + 'error - 'error which cannot be a key # + stackTrace - stackTrace which cannot be a key public type KeyValues record {| never msg?; never message?; + never time?; + never level?; never 'error?; never stackTrace?; Value...; @@ -63,6 +67,10 @@ public type AnydataKeyValues record { never msg?; # message which cannot be a key never message?; + # time which cannot be a key + never time?; + # level which cannot be a key + never level?; # 'error which cannot be a key never 'error?; # stackTrace which cannot be a key From f273411c95f757e2d6ff7a39989bb6d503397db2 Mon Sep 17 00:00:00 2001 From: Better-Boy Date: Mon, 13 Oct 2025 14:05:08 +0000 Subject: [PATCH 3/6] updated changelog and spec --- changelog.md | 7 +++++++ docs/spec/spec.md | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/changelog.md b/changelog.md index e07a31d4..0d6b4f7c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,13 @@ # Change Log This file contains all the notable changes done to the Ballerina TCP package through the releases. +## [2.15.0] - 2025-10-13 + +### Fixed + +- [Passing time as key in KeyValue pair replaces the logged time with the context value](https://github.com/ballerina-platform/ballerina-library/issues/7728) +- [Passing message as key in KeyValue pair replaces the logged message with the context value](https://github.com/ballerina-platform/ballerina-library/issues/8232) + ## [2.14.0] - 2025-10-09 ### Added diff --git a/docs/spec/spec.md b/docs/spec/spec.md index a84a2ab1..ab64e8e6 100644 --- a/docs/spec/spec.md +++ b/docs/spec/spec.md @@ -100,6 +100,10 @@ time=2025-08-20T08:53:29.987+05:30 level=INFO module="" message="info log" curre time=2025-08-20T08:53:29.998+05:30 level=INFO module="" message="info log for id: 845315" ctx="{name: foo}" ``` +> Note: +> The key-value pairs provided for logging must not use the reserved keys `message`, `time`, or `level`. +> These keys are reserved for the log record fields and will result in a compile-time error if specified. + ## 3. Configure logging ### 3.1. Configure root log level From 50ddcb8062e48fb867e5cb84255f03547a715025 Mon Sep 17 00:00:00 2001 From: Better-Boy Date: Mon, 13 Oct 2025 19:58:36 +0530 Subject: [PATCH 4/6] Update docs/spec/spec.md Co-authored-by: Krishnananthalingam Tharmigan <63336800+TharmiganK@users.noreply.github.com> --- docs/spec/spec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/spec/spec.md b/docs/spec/spec.md index ab64e8e6..2f61c559 100644 --- a/docs/spec/spec.md +++ b/docs/spec/spec.md @@ -100,7 +100,7 @@ time=2025-08-20T08:53:29.987+05:30 level=INFO module="" message="info log" curre time=2025-08-20T08:53:29.998+05:30 level=INFO module="" message="info log for id: 845315" ctx="{name: foo}" ``` -> Note: +> **Note:** > The key-value pairs provided for logging must not use the reserved keys `message`, `time`, or `level`. > These keys are reserved for the log record fields and will result in a compile-time error if specified. From e5a99a07198f42e54653649e4210a38ff0681d0b Mon Sep 17 00:00:00 2001 From: Better-Boy Date: Thu, 23 Oct 2025 11:41:37 +0530 Subject: [PATCH 5/6] Update changelog.md Co-authored-by: Krishnananthalingam Tharmigan <63336800+TharmiganK@users.noreply.github.com> --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 0d6b4f7c..90c987d6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,5 @@ # Change Log -This file contains all the notable changes done to the Ballerina TCP package through the releases. +This file contains all the notable changes done to the Ballerina Log package through the releases. ## [2.15.0] - 2025-10-13 From 93b1a0b3d2ffe7f95c6a94b015da0b83fe58bf27 Mon Sep 17 00:00:00 2001 From: Better-Boy Date: Thu, 23 Oct 2025 11:41:53 +0530 Subject: [PATCH 6/6] Update changelog.md Co-authored-by: Krishnananthalingam Tharmigan <63336800+TharmiganK@users.noreply.github.com> --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 90c987d6..353d91bb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,7 @@ # Change Log This file contains all the notable changes done to the Ballerina Log package through the releases. -## [2.15.0] - 2025-10-13 +## [Unreleased] ### Fixed