mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
puts newlines at the end of log statement if missing
This commit is contained in:
@@ -8,6 +8,7 @@ import Data.Aeson ( (.:)
|
||||
, withObject
|
||||
, withText
|
||||
)
|
||||
import qualified Data.Text as T
|
||||
import Foundation
|
||||
import Settings ( AppSettings(errorLogRoot) )
|
||||
import Startlude hiding ( Handler )
|
||||
@@ -40,4 +41,6 @@ postErrorLogsR :: Handler ()
|
||||
postErrorLogsR = do
|
||||
ErrorLog {..} <- requireCheckJsonBody @_ @ErrorLog
|
||||
root <- getsYesod $ errorLogRoot . appSettings
|
||||
void $ liftIO $ forkIO $ appendFile (root </> show errorLogEpoch <.> "log") errorLogMessage
|
||||
void $ liftIO $ forkIO $ appendFile (root </> show errorLogEpoch <.> "log") $ if "\n" `T.isSuffixOf` errorLogMessage
|
||||
then errorLogMessage
|
||||
else T.snoc errorLogMessage '\n'
|
||||
|
||||
Reference in New Issue
Block a user