Skip to content

Commit d63d7b1

Browse files
angelmp01Angel Martinez
andcommitted
Add input doc log (#62)
- Changed req body data log from info to debug - Added prettyprint to log Co-authored-by: Angel Martinez <angel_2.martinez@boehringer-ingelheim.com> (cherry picked from commit 25f498c)
1 parent 0ee726f commit d63d7b1

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/main/groovy/app/App.groovy

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package app
22

33
import com.typesafe.config.ConfigFactory
4-
import groovy.json.JsonSlurper
54
import groovy.util.logging.Slf4j
5+
import org.apache.groovy.json.internal.LazyMap
66
import org.jooby.Jooby
77
import org.jooby.MediaType
88
import org.jooby.json.Jackson
99

1010
import java.nio.file.Files
1111

12+
import static groovy.json.JsonOutput.prettyPrint
13+
import static groovy.json.JsonOutput.toJson
1214
import static org.jooby.JoobyExtension.get
1315
import static org.jooby.JoobyExtension.post
1416

@@ -20,15 +22,16 @@ class App extends Jooby {
2022
use(new DocGen())
2123

2224
post(this, "/document", { req, rsp ->
23-
def body = new JsonSlurper().parseText(req.body().value())
2425

25-
if (log.isInfoEnabled()) {
26-
log.info("Input request body before send it to convert it to a pdf: ");
27-
log.info(body.toString());
28-
}
26+
def body = req.body().to(LazyMap.class)
2927

3028
validateRequestParams(body)
3129

30+
if (log.isDebugEnabled()) {
31+
log.debug("Input request body data before send it to convert it to a pdf: ")
32+
log.debug(prettyPrint(toJson(body.data)))
33+
}
34+
3235
def pdf = new DocGen().generate(body.metadata.type, body.metadata.version, body.data)
3336
rsp.send([
3437
data: pdf.encodeBase64().toString()

0 commit comments

Comments
 (0)