summaryrefslogtreecommitdiff
path: root/cask/util/src/cask/util/Logger.scala
blob: 2afbb48b7d7da75d6150b776cc4703158ef240ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package cask.util

import sourcecode.{File, Line, Text}

trait Logger {
  def exception(t: Throwable): Unit

  def debug(t: sourcecode.Text[Any])(implicit f: sourcecode.File, line: sourcecode.Line): Unit
}
object Logger{
  object Console {
    implicit object globalLogger extends Console()
  }
  class Console() extends Logger{
    def exception(t: Throwable): Unit = t.printStackTrace()

    def debug(t: Text[Any])(implicit f: File, line: Line): Unit = {
      println(f.value.split('/').last + ":" + line + " " + t.source + " " + pprint.apply(t.value))
    }
  }
}