indianghost-dumphelper (v1.0.0)
indianghost-dumphelper is a lightweight package providing a dump helper that can print an object in json format or structured text.
It is hightly recommended to use it in log files when it's not possible to debug objects in localhost.
Maven
It's easy, you should just add this dependency to your pom.xml file:
<dependency>
<groupId>io.github.indianghost</groupId>
<artifactId>indianghost-dumphelper</artifactId>
<version>1.0.0</version>
</dependency>
Examples of use
First of all you should import the class DumpHelper:
import io.github.indianghost.DumpHelper;
Then you can use the method dumpProperties(obj) as:
log.info(DumpHelper.dumpProperties(entityForDemo));
to get the output:
io.github.indianghost.EntityForDemo@351d0846[
age=30
marks=[9.62, 11.14, 17.0]
name=Lorem ipsum
]
Or, you can use the method dumpAsJson(obj) as:
log.info(DumpHelper.dumpAsJSON(entityForDemo));
to get the output:
{
"name" : "Lorem ipsum",
"age" : 30,
"marks" : [ 9.62, 11.14, 17.0 ]
}