Skip to content

Commit

Permalink
Remove Try as unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
laurilehmijoki committed Jan 21, 2015
1 parent d4766da commit b1ae12e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/scala/s3/website/Logger.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package s3.website

import scala.util.Try

class Logger(val verboseOutput: Boolean, onLog: Option[(String) => _] = None) {
def debug(msg: String) = if (verboseOutput) log(Debug, msg)
def info(msg: String) = log(Info, msg)
Expand All @@ -12,11 +10,11 @@ class Logger(val verboseOutput: Boolean, onLog: Option[(String) => _] = None) {

def pending(msg: String) = log(Wait, msg)

private def log(logType: LogType, msgRaw: String): Try[Unit] = {
private def log(logType: LogType, msgRaw: String) = {
val msg = msgRaw.replaceAll("\\n", "\n ") // Indent new lines, so that they arrange nicely with other log lines
val decoratedLogMessage = s"[$logType] $msg"
onLog.foreach(_(decoratedLogMessage))
Try(println(decoratedLogMessage))
println(decoratedLogMessage)
}

sealed trait LogType {
Expand Down

0 comments on commit b1ae12e

Please sign in to comment.