Package

purescript-logging-journald

Repository
paluh/purescript-logging-journald
License
BSD-3-Clause
Uploaded by
paluh
Published on
2022-06-19T21:01:38Z

A drop of glue between purescript-logging and purescript-systemd-journald.

Usage

module Test.Main where

import Prelude

import Control.Logger (log)
import Control.Logger.Journald (Level(Debug, Emerg), logger)
import Effect (Effect)
import Node.Systemd.Journald (journald)

main :: Effect Unit
main = do
  j ← journald {}
  let l = logger j
  log l { level: Emerg, message: "first", fields: {extraInfo: "extra1"} }
  log l { level: Debug, message: "second", fields: {extraInfo: "extra2"} }

There is also logger' shortcut if you want to work in the given monad:

l' ← logger' (journald {})

You can provide extra fields (through fields attribute) - purescript-systemd-journald accepts nearly anything there. For more info please consult its docs.

Log levels

There are Ord and Eq instances provided for Level type so you can do filtering like cfilter (\e → e.level > Warning).