sbt/sbt-bintray

Replace `println` by `info` in logger

jvican opened this issue · 5 comments

The codebase has too many println. We should use the sbt logger and pass it in from function to function.

See comment in #113.

I found there are only 2 println be left in the codebase. Those exist in L25 and L57 of Resolver.scala. I am curious are those need to fix? If it needs to fix, I could give it a shot. Or maybe this issue could be close.

Yeah, they are to fix. Would really appreciate if you give it a shot! 😄

After I tried some experiments. I have 3 solutions, they all had different log results. I am not sure which one is better.

  1. Only remove println and keep throw new RuntimeException(s"error uploading to $dest: $fail")
[trace] Stack trace suppressed: run last *:publish for the full output.
[error] (*:publish) error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/jars/sbt-bintray.jar: {"message":"This resource requires authentication"}
  1. Only replace println to sbt logger.
[error] {"message":"This resource requires authentication"}
[trace] Stack trace suppressed: run last *:publish for the full output.
[error] (*:publish) error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/jars/sbt-bintray.jar: {"message":"This resource requires authentication"}
  1. Replace println to sbt logger, remove throw new RuntimeException(s"error uploading to $dest: $fail"), and merge message of RuntimeException to sbt logger.
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/jars/sbt-bintray.jar: {"message":"This resource requires authentication"}
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/jars/sbt-bintray.jar.sha1: {"message":"This resource requires authentication"}
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/jars/sbt-bintray.jar.md5: {"message":"This resource requires authentication"}
[info] 	published sbt-bintray to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/jars/sbt-bintray.jar
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/srcs/sbt-bintray-sources.jar: {"message":"This resource requires authentication"}
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/srcs/sbt-bintray-sources.jar.sha1: {"message":"This resource requires authentication"}
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/srcs/sbt-bintray-sources.jar.md5: {"message":"This resource requires authentication"}
[info] 	published sbt-bintray to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/srcs/sbt-bintray-sources.jar
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/docs/sbt-bintray-javadoc.jar: {"message":"This resource requires authentication"}
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/docs/sbt-bintray-javadoc.jar.sha1: {"message":"This resource requires authentication"}
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/docs/sbt-bintray-javadoc.jar.md5: {"message":"This resource requires authentication"}
[info] 	published sbt-bintray to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/docs/sbt-bintray-javadoc.jar
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/ivys/ivy.xml: {"message":"This resource requires authentication"}
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/ivys/ivy.xml.sha1: {"message":"This resource requires authentication"}
[error] error uploading to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/ivys/ivy.xml.md5: {"message":"This resource requires authentication"}
[info] 	published ivy to org.foundweekends/sbt-bintray/scala_2.10/sbt_0.13/0.5.2-SNAPSHOT/ivys/ivy.xml
[trace] Stack trace suppressed: run last *:bintrayRelease for the full output.
[error] (*:bintrayRelease) failed to release sbt/sbt-bintray@0.5.2-SNAPSHOT: {"message":"This resource requires authentication"}

In my opinion, I think 1. would much easier for user to read.

Yeah, I agree 1. is the way to go.