Reputation: 2217
I am trying to find all cases of println
and replace them with log.debug()
for starters, then clean up the logs. Is there a tool somewhere than can help me do that? Is this even possible? We are trying to replace both the beginning of a line with log.debug(
AND the end of it, with the )
.
We are on:
Groovy 2.5.11
Java 1.8
IntelliJ IDEA 2020.2.1 (Ultimate Edition) Build #IU-202.6948.69
Windows OS
Example:
//find all instances of (text in logs is varied)
println "this is a log"
//and replace with
log.debug("this is a log")
Upvotes: 1
Views: 53
Reputation: 401975
println "(.*?)"
log.debug("$1")
Notice the regex search option is enabled (.*
icon on the right).
More details in IntelliJ IDEA documentation.
Upvotes: 2