The `@log` does not use mixed or wrapper, but directly uses macro to generate default log object and operate log.
The `@log` does not use mixed or wrapper, but directly uses macro to generate default log object and operate log. (Log dependency needs to be introduced)
- Note
-`verbose` Whether to enable detailed log.
...
...
@@ -157,7 +157,7 @@ The `@log` does not use mixed or wrapper, but directly uses macro to generate de
-`io.github.dreamylost.logs.LogType.Slf4j` use `org.slf4j.Logger`
-`io.github.dreamylost.logs.LogType.ScalaLoggingLazy` implement by `scalalogging.LazyLogging` but field was renamed to `log`
-`io.github.dreamylost.logs.LogType.ScalaLoggingStrict` implement by `scalalogging.StrictLogging` but field was renamed to `log`
- Support `class`, `case class` and `object`.
- Support `class` and `object`.
- Example
...
...
@@ -266,3 +266,45 @@ class Person extends scala.AnyRef {
}
}
```
## @jacksonEnum
The `jacksonEnum` annotation is used to provide `Jackson` serialization support for all Scala enumeration type parameters in the primary constructor of the class. (jackson and jackson-scala-module dependency needs to be introduced)
- Note
-`verbose` Whether to enable detailed log. default is `false`.
-`nonTypeRefers` Specifies the enumeration type of the `TypeReference` subclass of `Jackson` that does not need to be created. default is `Nil`.
- Support `case class` and `class`.
- If the enumeration type has subclasses of `TypeReference`, no new subclasses will be generated,
and `JsonScalaEnumeration` annotation will not be added to the parameters repeatedly. This is mainly used to solve conflict problems.
@@ -45,18 +45,6 @@ class LogTest extends AnyFlatSpec with Matchers {
"""@log(verbose=true, logType=io.github.dreamylost.logs.LogType.JLog) class TestClass6(val i: Int = 0, var j: Int)"""shouldcompile
}
"log2"should"ok on case class"in{
"""@log(verbose=true) case class TestClass1(val i: Int = 0, var j: Int) {
log.info("hello")
}"""shouldcompile
"""@log case class TestClass2(val i: Int = 0, var j: Int)"""shouldcompile
"""@log() case class TestClass3(val i: Int = 0, var j: Int)"""shouldcompile
"""@log(verbose=true) case class TestClass4(val i: Int = 0, var j: Int)"""shouldcompile
"""@log(logType=io.github.dreamylost.logs.LogType.JLog) case class TestClass5(val i: Int = 0, var j: Int)"""shouldcompile
"""@log(verbose=true, logType=io.github.dreamylost.logs.LogType.JLog) case class TestClass6(val i: Int = 0, var j: Int)"""shouldcompile
}
"log3"should"ok on object"in{
"""@log(verbose=true) object TestClass1 {
log.info("hello")
...
...
@@ -121,8 +109,8 @@ class LogTest extends AnyFlatSpec with Matchers {
"log8 slf4j"should"ok on class and has object"in{
"""@log(verbose=true) class TestClass1(val i: Int = 0, var j: Int) {
log.info("hello")
}"""shouldcompile
log.info("hello")
}"""shouldcompile
"""@toString @builder @log class TestClass2(val i: Int = 0, var j: Int)"""shouldcompile//Use with multiple annotations
"""@log() class TestClass3(val i: Int = 0, var j: Int)"""shouldcompile
...
...
@@ -131,7 +119,13 @@ class LogTest extends AnyFlatSpec with Matchers {
"""@log(verbose=true, logType=io.github.dreamylost.logs.LogType.Slf4j) class TestClass6(val i: Int = 0, var j: Int)"""shouldcompile
"""@log(verbose=true, logType=io.github.dreamylost.logs.LogType.Slf4j) class TestClass6(val i: Int = 0, var j: Int){ log.info("hello world") }"""shouldcompile
"""@log(logType = io.github.dreamylost.logs.LogType.Slf4j) @builder class TestClass6(val i: Int = 0, var j: Int){ log.info("hello world") }