packages feed

journalctl-stream 0.1.0.0 → 0.2.0.0

raw patch · 4 files changed

+30/−5 lines, 4 filesdep −unixPVP ok

version bump matches the API change (PVP)

Dependencies removed: unix

API changes (from Hackage documentation)

+ Systemd.Journalctl.Stream: [entryExecutable] :: Entry -> FilePath
+ Systemd.Journalctl.Stream: [entryNamespace] :: Entry -> Maybe Text
+ Systemd.Journalctl.Stream: [entryProcess] :: Entry -> Text
- Systemd.Journalctl.Stream: Entry :: ProcessID -> Text -> Cursor -> POSIXTime -> Maybe Text -> Text -> Entry
+ Systemd.Journalctl.Stream: Entry :: ProcessID -> Text -> Maybe Text -> Text -> FilePath -> Cursor -> POSIXTime -> Maybe Text -> Text -> Entry

Files

changelog.md view
@@ -1,2 +1,5 @@+## 0.2.0.0+* Added new fields: `entryNamespace`, `entryProcess`, `entryExecutable`.+ ## 0.1.0.0 * First release.
journalctl-stream.cabal view
@@ -2,7 +2,7 @@ category: System synopsis: Stream logs using journalctl. description: Stream logs using journalctl. Check the documentation for more details.-version: 0.1.0.0+version: 0.2.0.0 author: Daniel Casanueva (daniel.casanueva `at` proton.me) maintainer: Daniel Casanueva (daniel.casanueva `at` proton.me) license: MIT@@ -15,6 +15,6 @@   hs-source-dirs: lib   default-language: Haskell2010   default-extensions: ImportQualifiedPost, OverloadedStrings-  ghc-options: -Wall-  build-depends: base < 4.18, aeson, conduit, process, unix, text, time+  ghc-options: -Wall -Wunused-packages+  build-depends: base < 4.18, aeson, conduit, process, text, time   exposed-modules: Systemd.Journalctl.Stream
lib/Systemd/Journalctl/Stream.hs view
@@ -21,11 +21,10 @@ import System.IO (Handle) import Data.Maybe (fromJust) import Control.Exception qualified as Base+import System.Posix.Types (CPid (..), ProcessID) -- text import Data.Text (Text) import Data.Text.Encoding (encodeUtf8)--- unix-import System.Posix.Types (CPid (..), ProcessID) -- aeson import Data.Aeson (FromJSON, (.:), (.:?)) import Data.Aeson qualified as JSON@@ -53,6 +52,12 @@     entryPID :: ProcessID     -- | The name of the originating host.   , entryHostname :: Text+    -- | Namespace identifier.+  , entryNamespace :: Maybe Text+    -- | Process name.+  , entryProcess :: Text+    -- | File path to the executable.+  , entryExecutable :: FilePath     -- | The cursor for the entry.   , entryCursor :: Cursor     -- | The time the entry was received by the journal.@@ -63,16 +68,29 @@   , entryMessage :: Text     } deriving Show +-- | Utility type to parse values (mainly numbers) that are received+--   as text. newtype AsText a = AsText { asText :: a } deriving Show  instance FromJSON a => FromJSON (AsText a) where   parseJSON = JSON.withText "AsText" $     either fail (pure . AsText) . JSON.eitherDecodeStrict . encodeUtf8 +{- Journal fields++For a more complete list of fields and documentation, go to:++https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html++-}+ instance FromJSON Entry where   parseJSON = JSON.withObject "Entry" $ \o -> Entry     <$> (CPid . asText <$> o .: "_PID")     <*> o .: "_HOSTNAME"+    <*> o .:? "_NAMESPACE"+    <*> o .: "_COMM"+    <*> o .: "_EXE"     <*> o .: "__CURSOR"     <*> (secondsToNominalDiffTime . (/1000000) . asText <$> o .: "__REALTIME_TIMESTAMP")     <*> o .:? "UNIT"
readme.md view
@@ -1,3 +1,7 @@ # journalctl-stream  Simple library for Haskell that calls `journalctl` and streams the results.++## Distribution++[![Hackage](https://img.shields.io/hackage/v/journalctl-stream?style=for-the-badge)](https://hackage.haskell.org/package/journalctl-stream)