enhancement: logX should not be a string interpolator #35
Comments
+1, noticed that too recently. It will look more reasonable as 1-arg fn, so you could write ----- Reply message ----- it removes room for one to use other string interpolators, e.g. for formatting (f) also, logX doesn't do anything special other than insert the variables. no reason to use string interp. and it looks ugly logV"foo"() ? yuck :( logV(f"$interp%02d") that's pretty reasonable (all other implicits for logtag, etc. are ok) Reply to this email directly or view it on GitHubhttps://github.com//issues/35. |
Agreed. The initial intuition was that |
What about this? // manual tag
log("tag").d("foo")
// no tag
log.d("foo")
// implicit tag
implicit val logTag = LogTag("tag")
log.d("foo") |
1arg function like this should work fine: logD(msg: String)(implicit logTag: LogTag) It can have a friend like this logD(logTag: String, msg: String) But your approach with |
Weird, I can’t enable formatting in your comment. Anyway, could you elaborate? scala> def logD(msg: String)(implicit a: Int = 1) = msg
logD: (msg: String)(implicit a: Int)String
scala> logD "foo"
<console>:1: error: ';' expected but string literal found.
logD "foo"
^ It would also be definitely broken because of overloading (to support If you are really concerned about runtime efficiency, it should probably be made into a macro. |
Yep, It can't be used without parentheses, of course, only like here: http://scastie.org/6297 |
I’ve just noticed that the commit referenced here went into |
This functionality does not really belong in Macroid. A possible replacement is a combination of [1] and [2]. Also see #35. [1] http://www.slf4j.org/android/ [2] https://github.com/typesafehub/scala-logging
it removes room for one to use other string interpolators, e.g. for formatting (f)
also, logX doesn't do anything special other than insert the variables. no reason to use string interp. and it looks ugly
logV"foo"()
? yuck :(logV(f"$interp%02d")
that's pretty reasonable (all other implicits for logtag, etc. are ok)The text was updated successfully, but these errors were encountered: