Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use bytestring for multithreaded stderr output #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hslogger.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ Library
if !os(windows)
Build-Depends: unix
if flag(small_base)
build-depends: base >= 4 && < 5, containers, directory, process,
time, old-locale
build-depends: base >= 4 && < 5, bytestring, containers, directory,
process, time, old-locale
else
build-depends: base < 3, time
-- GHC-Options: -O2
Expand Down
3 changes: 2 additions & 1 deletion src/System/Log/Handler/Syslog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module System.Log.Handler.Syslog(
) where

import qualified Control.Exception as E
import qualified Data.ByteString.Char8 as BC
import System.Log
import System.Log.Formatter
import System.Log.Handler
Expand Down Expand Up @@ -249,7 +250,7 @@ instance LogHandler SyslogHandler where
setFormatter sh f = sh{formatter = f}
getFormatter sh = formatter sh
emit sh (prio, msg) _ = do
when (elem PERROR (options sh)) (hPutStrLn stderr msg)
when (elem PERROR (options sh)) (BC.hPutStrLn stderr $ BC.pack msg)
pidPart <- getPidPart
void $ sendstr (toSyslogFormat msg pidPart)
where
Expand Down