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

Prelude logs for all #15

Merged
2 commits merged into from Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions nri-prelude/nri-prelude.cabal
Expand Up @@ -105,6 +105,7 @@ library
, terminal-size >=0.3.2.1 && <0.4
, text >=1.2.3.1 && <1.3
, time >=1.8.0.2 && <1.13
, unix >=2.7.2.2 && <2.8.0.0
, vector >=0.12.1.2 && <0.13
default-language: Haskell2010

Expand Down Expand Up @@ -196,5 +197,6 @@ test-suite tests
, terminal-size >=0.3.2.1 && <0.4
, text >=1.2.3.1 && <1.3
, time >=1.8.0.2 && <1.13
, unix >=2.7.2.2 && <2.8.0.0
, vector >=0.12.1.2 && <0.13
default-language: Haskell2010
1 change: 1 addition & 0 deletions nri-prelude/package.yaml
Expand Up @@ -38,6 +38,7 @@ library:
- terminal-size >= 0.3.2.1 && < 0.4
- text >= 1.2.3.1 && < 1.3
- time >= 1.8.0.2 && < 1.13
- unix >= 2.7.2.2 && < 2.8.0.0
- vector >= 0.12.1.2 && < 0.13
exposed-modules:
- Array
Expand Down
2 changes: 2 additions & 0 deletions nri-prelude/src/Platform/DevLog.hs
Expand Up @@ -13,6 +13,7 @@ import NriPrelude
import qualified Platform.Internal
import qualified System.IO
import qualified System.IO.Unsafe
import qualified System.Posix.Files
import qualified Prelude

-- | Write a tracing span to the development log, where it can be found by
Expand All @@ -26,6 +27,7 @@ writeSpanToDevLog span = do
logFile
System.IO.AppendMode
( \handle -> do
System.Posix.Files.setFileMode logFile System.Posix.Files.stdFileMode
Data.ByteString.Lazy.hPut handle (Aeson.encode (now, span))
Data.ByteString.Lazy.hPut handle "\n"
)
Expand Down