Skip to content

Commit

Permalink
Provided a LogFormat for Syslog
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Nov 7, 2023
1 parent 7811d88 commit f978fcc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/logging.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ case class Realm private(name: Text):
object Level:
given Ordering[Level] = Ordering[Int].on[Level](_.ordinal)
given Communicable[Level] = level => Message(level.show.upper)
given Show[Level] = _.toString.tt.upper

enum Level:
case Fine, Info, Warn, Fail
Expand Down
3 changes: 3 additions & 0 deletions src/syslog/syslog.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ import guillotine.*
import rudiments.*
import parasite.*
import anticipation.*
import gossamer.*
import turbulence.*
import perforate.*

case class Syslog(tag: Text)

object Syslog:
given LogFormat[Syslog] = entry =>
t"[${entry.level}] ${entry.realm}: ${entry.message}\n"

given (using Monitor): Appendable[Syslog, Text] = (syslog, stream) =>
safely:
Expand Down

0 comments on commit f978fcc

Please sign in to comment.