Skip to content
Open
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
12 changes: 9 additions & 3 deletions app2/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import com.typesafe.scalalogging.Logger
// import org.log4s.getLogger
import testframework._

object Main extends App {

println(implicitly[Position])
println(implicitly[TpeTag[List[String]]])
println(s"actuallyAnInt: Int as given by ${implicitly[actuallyAnInt.type <:< Int]}")
val logger = Logger("main2")
// val logger = getLogger("main2")

log(implicitly[Position])
log(implicitly[TpeTag[List[String]]])
log(s"actuallyAnInt: Int as given by ${implicitly[actuallyAnInt.type <:< Int]}")

logger.info("Hello, World!")
}
11 changes: 8 additions & 3 deletions app3/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import com.typesafe.scalalogging.Logger
import testframework.{_, given}

object Main extends App {

println(implicitly[Position])
println(implicitly[TpeTag[List[String]]])
println(s"actuallyAnInt: Int as given by ${implicitly[actuallyAnInt.type <:< Int]}")
val logger = Logger("main3")

log(implicitly[Position])
log(implicitly[TpeTag[List[String]]])
log(s"actuallyAnInt: Int as given by ${implicitly[actuallyAnInt.type <:< Int]}")

logger.info("Hello, World!")

}
17 changes: 15 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ThisBuild / scalaVersion := "3.0.2"
val scala213 = "2.13.7"
val scala213 = "2.13.8"

lazy val scala2macros = project
.dependsOn(shared)
Expand All @@ -14,6 +14,10 @@ lazy val testframework = project
.dependsOn(shared, scala2macros)
.settings(
name := "testframework",
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.10",
libraryDependencies += "com.typesafe.scala-logging" % "scala-logging_3" % "3.9.4",
// libraryDependencies += "org.log4s" % "log4s_3" % "1.10.0",
// libraryDependencies += "org.clapper" % "grizzled-slf4j_3"
)

lazy val shared = project
Expand All @@ -27,10 +31,19 @@ lazy val app2 = project
name := "mix-macros-demo-scala2",
scalaVersion := scala213,
scalacOptions += "-Ytasty-reader",
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.10",
libraryDependencies += "com.typesafe.scala-logging" % "scala-logging_3" % "3.9.4",
// libraryDependencies += "org.log4s" % "log4s_3" % "1.10.0",
// libraryDependencies += "org.clapper" % "grizzled-slf4j_3"
)

lazy val app3 = project
.dependsOn(testframework)
.settings(
name := "mix-macros-demo-scala3"
name := "mix-macros-demo-scala3",
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.10",
libraryDependencies += "com.typesafe.scala-logging" % "scala-logging_3" % "3.9.4",
// libraryDependencies += "org.log4s" % "log4s_3" % "1.10.0",
// libraryDependencies += "org.clapper" % "grizzled-slf4j_3"
)

8 changes: 8 additions & 0 deletions testframework/src/main/scala/testframework/package.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import com.typesafe.scalalogging.Logger
// import org.log4s.getLogger

package object testframework:

private def logger = Logger("testframework")
// private def logger = getLogger("testframework")

import scala.language.experimental.macros

implicit def pos: Position = macro Scala2Macros.posImpl
Expand All @@ -10,3 +16,5 @@ package object testframework:

def actuallyAnInt: Any = macro Scala2Macros.Whitebox.actuallyAnIntImpl
transparent inline def actuallyAnInt: Any = ${ Macros.actuallyAnIntImpl }

def log(str: Any): Unit = logger.info(str.toString)