You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2023/01/28 23:18:06 UTC

[logging-log4j-kotlin] branch master updated: Add 1.3.0 features to README (but commented out)

This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j-kotlin.git


The following commit(s) were added to refs/heads/master by this push:
     new 959a510  Add 1.3.0 features to README (but commented out)
959a510 is described below

commit 959a510d48325f9bea005ecadb840a5eef80718d
Author: Matt Sicker <ma...@apache.org>
AuthorDate: Sat Jan 28 17:17:54 2023 -0600

    Add 1.3.0 features to README (but commented out)
---
 README.md | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 0fe7c6e..1e88946 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ import org.apache.logging.log4j.kotlin.Logging
 class MyClass: BaseClass {
     companion object : Logging
     
-    ...
+    // ...
 }
 ```
 
@@ -56,12 +56,48 @@ import org.apache.logging.log4j.kotlin
 class MyClass: BaseClass {
     val logger = logger()
     
-    ...
+    // ...
 }
 ```
 
 The function `logger()` is an extension function on the Any type (or more specifically, any type `T` that extends `Any`).
 
+<!--
+TODO: uncomment when 1.3.0 is released:
+Beginning in version 1.3.0, an extension property is also available on classes:
+
+```kotlin
+import org.apache.logging.log4j.kotlin.logger
+
+class MyClass: BaseClass {
+  init {
+    logger.info("Hello, world!")
+  }
+}
+```
+
+Also added in version 1.3.0, the `ThreadContext` API has two facade objects provided: `ContextMap` and `ContextStack`.
+
+```kotlin
+import org.apache.logging.log4j.kotlin.ContextMap
+import org.apache.logging.log4j.kotlin.ContextStack
+
+ContextMap["key"] = "value"
+assert(ContextMap["key"] == "value")
+assert("key" in ContextMap)
+
+ContextMap += "anotherKey" to "anotherValue"
+ContextMap -= "key"
+
+ContextStack.push("message")
+assert(!ContextStack.empty)
+assert(ContextStack.depth == 1)
+val message = ContextStack.peek()
+assert(message == ContextStack.pop())
+assert(ContextStack.empty)
+```
+-->
+
 ## Documentation
 
 The Kotlin's Log4j 2 User's Guide is available [here](https://logging.apache.org/log4j/kotlin/index.html).