fun <T> T.debug(): T {
println(this)
return this
}
👍 5
o
okkero
05/07/2017, 3:33 PM
poohbar: This can be shortened further:
fun <T> T.debug() = also(::println)
😉
👍 1
p
poohbar
05/07/2017, 3:41 PM
uuuhhhhh.. fancy!
d
dathoang.se
05/16/2017, 3:00 AM
This would not be a good design anyway.
Only logger module has the responsibility of printing and managing logs.
Now you’re giving every object the responsibility, you’re violating the Single Responsibility Principle.