Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the new warn log level in various places #4665

Merged
merged 2 commits into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bsp/src/mill/bsp/BSP.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ object BSP extends ExternalModule with CoursierModule {
)(implicit ctx: Ctx): (PathRef, ujson.Value) = {
// we create a json connection file
val bspFile = ctx.workspace / Constants.bspDir / s"${serverName}.json"
if (os.exists(bspFile)) ctx.log.info(s"Overwriting BSP connection file: ${bspFile}")
if (os.exists(bspFile)) ctx.log.warn(s"Overwriting BSP connection file: ${bspFile}")
else ctx.log.info(s"Creating BSP connection file: ${bspFile}")
val withDebug = ctx.log.debugEnabled
if (withDebug) ctx.log.debug(
Expand Down
8 changes: 3 additions & 5 deletions contrib/docker/src/mill/contrib/docker/DockerModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ trait DockerModule { outer: JavaModule =>

val result = if (platform().isEmpty || executable() != "docker") {
if (platform().nonEmpty)
log.info("Platform parameter is ignored when using non-docker executable")
log.warn("Platform parameter is ignored when using non-docker executable")
os.proc(executable(), "build", tagArgs, pullLatestBase, dest)
.call(stdout = os.Inherit, stderr = os.Inherit, env = env)
} else {
Expand All @@ -194,10 +194,8 @@ trait DockerModule { outer: JavaModule =>
)
.call(stdout = os.Inherit, stderr = os.Inherit, env = env)
}
log.info(s"Docker build completed ${
if (result.exitCode == 0) "successfully"
else "unsuccessfully"
} with ${result.exitCode}")
if (result.exitCode == 0) log.info(s"Docker build completed successfully")
else log.warn(s"Docker build completed unsuccessfully with code ${result.exitCode}")
tags()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ trait ScalaPBModule extends ScalaModule {
if (entry.getName.endsWith(".proto")) {
val protoDest = dest / os.SubPath(entry.getName)
if (os.exists(protoDest))
Task.log.error(s"Warning: Overwriting ${dest} / ${os.SubPath(entry.getName)} ...")
Task.log.warn(s"Overwriting ${dest} / ${os.SubPath(entry.getName)} ...")
Using.resource(os.write.over.outputStream(protoDest, createFolders = true)) { os =>
_root_.os.Internals.transfer(zip, os, close = false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
public interface ScoverageReportWorkerApi2 {

interface Logger {
void info(String msg);
void error(String msg);

void warn(String msg);

void error(String msg);
void info(String msg);

void debug(String msg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class ScoverageReportWorker extends AutoCloseable {

def ctx0(implicit ctx: Ctx): ApiCtx = {
val logger = new ApiLogger {
def info(msg: String): Unit = ctx.log.info(msg)
def warn(msg: String): Unit = ctx.log.warn(msg)
def error(msg: String): Unit = ctx.log.error(msg)
def warn(msg: String): Unit = ctx.log.warn(msg)
def info(msg: String): Unit = ctx.log.info(msg)
def debug(msg: String): Unit = ctx.log.debug(msg)
}
new ApiCtx {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ScoverageReportWorkerImpl extends ScoverageReportWorkerApi2 {
ctx.log.info(s"Branch coverage....: ${coverage.branchCoverageFormatted}%")
}
case None =>
ctx.log.error(s"No coverage data found in [${dataDirs.mkString(", ")}]")
ctx.log.warn(s"No coverage data found in [${dataDirs.mkString(", ")}]")
}
} catch {
case e: Throwable =>
Expand Down
4 changes: 2 additions & 2 deletions kotlinlib/src/mill/kotlinlib/KotlinWorkerManagerImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ class KotlinWorkerManagerImpl(ctx: Ctx) extends KotlinWorkerManager with AutoClo
val impl = classLoader.loadClass(className)
val worker = impl.getConstructor().newInstance().asInstanceOf[KotlinWorker]
if (worker.getClass().getClassLoader() != classLoader) {
ctx.log.error(
ctx.log.warn(
"""Worker not loaded from worker classloader.
|You should not add the mill-kotlin-worker JAR to the mill build classpath""".stripMargin
)
}
if (worker.getClass().getClassLoader() == classOf[KotlinWorker].getClassLoader()) {
ctx.log.error("Worker classloader used to load interface and implementation")
ctx.log.warn("Worker classloader used to load interface and implementation")
}
worker -> 0
}
Expand Down
2 changes: 1 addition & 1 deletion kotlinlib/src/mill/kotlinlib/js/KotlinJsModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ trait KotlinJsModule extends KotlinModule { outer =>
moduleKind == ModuleKind.NoModule &&
binaryDir.toIO.listFiles().count(_.getName.endsWith(".js")) > 1
) {
Task.log.info("No module type is selected for the executable, but multiple .js files found in the output folder." +
Task.log.warn("No module type is selected for the executable, but multiple .js files found in the output folder." +
" This will probably lead to the dependency resolution failure.")
}

Expand Down
2 changes: 1 addition & 1 deletion scalajslib/src/mill/scalajslib/ScalaJSModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ trait ScalaJSModule extends scalalib.ScalaModule { outer =>

override def run(args: Task[Args] = Task.Anon(Args())): Command[Unit] = Task.Command {
if (args().value.nonEmpty) {
Task.log.error("Passing command line arguments to run is not supported by Scala.js.")
Task.log.warn("Passing command line arguments to run is not supported by Scala.js.")
}
finalMainClassOpt() match {
case Left(err) => Result.Failure(err)
Expand Down
2 changes: 1 addition & 1 deletion scalalib/src/mill/scalalib/ScalaModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ trait ScalaModule extends JavaModule with TestModule.ScalaModuleBase { outer =>
// Keep in sync with [[bspCompileClassesPath]]
override def compile: T[CompilationResult] = Task(persistent = true) {
val sv = scalaVersion()
if (sv == "2.12.4") Task.log.error(
if (sv == "2.12.4") Task.log.warn(
"""Attention: Zinc is known to not work properly for Scala version 2.12.4.
|You may want to select another version. Upgrading to a more recent Scala version is recommended.
|For details, see: https://github.com/sbt/zinc/issues/1010""".stripMargin
Expand Down
Loading