Skip to content

Commit

Permalink
Rather than hiding the RhyoliteLogAppender_Journald constructor on no…
Browse files Browse the repository at this point in the history
…n-linux platforms, add an error message
  • Loading branch information
ali-abrar committed Jan 26, 2019
1 parent 55d7c98 commit 345a0e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/Rhyolite/Backend/Logging.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ data LoggingContext m = LoggingContext
data RhyoliteLogAppender
= RhyoliteLogAppender_Stderr RhyoliteLogAppenderStderr
| RhyoliteLogAppender_File RhyoliteLogAppenderFile
#ifdef linux_HOST_OS
| RhyoliteLogAppender_Journald RhyoliteLogAppenderJournald -- journalctl log with syslogIdentifier specified.
#endif
| RhyoliteLogAppender_FileRotate RhyoliteLogAppenderFileRotate
-- fastlogger also supports time based rotation, but its API calls for a function which must parse a pair of "human readable" ByteStrings as dates. A buggy implementation of half of common lisp in json syntax is out of scope for this yakshave.
deriving (Generic, Eq, Ord, Show)
Expand Down Expand Up @@ -205,6 +203,8 @@ instance LogAppender RhyoliteLogAppender where
fastLoggerHelperThing $ LogFile (FileLogSpec filename fileSize backupNumber)
#ifdef linux_HOST_OS
RhyoliteLogAppender_Journald cfg -> return $ LoggingContext (return ()) (logToJournalCtl (syslogIdentifier $ _rhyoliteLogAppenderJournald_syslogIdentifier cfg))
#else
RhyoliteLogAppender_Journald {} -> error "RhyoliteLogAppender: journald is only supported on linux"
#endif

configLogger :: (LogAppender a, MonadIO m) => LoggingConfig a -> m (LoggingContext m)
Expand Down

2 comments on commit 345a0e2

@Ericson2314
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a good idea? it turns a compiler time error into a run time error. I rather revert this than merge #37 .

@3noch
Copy link
Collaborator

@3noch 3noch commented on 345a0e2 Feb 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stand by the original PR for this which uses a cabal flag to decide if this should be included: #7

Please sign in to comment.