mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-30 19:54:47 +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
|
, withObject
|
||||||
, withText
|
, withText
|
||||||
)
|
)
|
||||||
|
import qualified Data.Text as T
|
||||||
import Foundation
|
import Foundation
|
||||||
import Settings ( AppSettings(errorLogRoot) )
|
import Settings ( AppSettings(errorLogRoot) )
|
||||||
import Startlude hiding ( Handler )
|
import Startlude hiding ( Handler )
|
||||||
@@ -40,4 +41,6 @@ postErrorLogsR :: Handler ()
|
|||||||
postErrorLogsR = do
|
postErrorLogsR = do
|
||||||
ErrorLog {..} <- requireCheckJsonBody @_ @ErrorLog
|
ErrorLog {..} <- requireCheckJsonBody @_ @ErrorLog
|
||||||
root <- getsYesod $ errorLogRoot . appSettings
|
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