git.iko.soy/typeable/katip-rollbar
on master help sign in
5 files changed+77−49
since splitsnapshots
unifiedsplit
.gitignore+1−3 katip-rollbar.cabal+44 package.yaml−24 src/Katip/Scribes/Rollbar.hs+21−19 stack.yaml+11−3
.gitignore+1−3
@@ -1,7 +1,5 @@
11### Project specific ###
22
3−*.cabal
4−
53# Created by https://www.gitignore.io/api/vim,osx,linux,macos,emacs,windows,haskell,visualstudiocode
64
75### Emacs ###
@@ -184,4 +182,4 @@ $RECYCLE.BIN/
184182*.lnk
185183
186184
187−# End of https://www.gitignore.io/api/vim,osx,linux,macos,emacs,windows,haskell,visualstudiocode
185+# End of https://www.gitignore.io/api/vim,osx,linux,macos,emacs,windows,haskell,visualstudiocode
katip-rollbar.cabalnew file+44
@@ -0,0 +1,44 @@
1+cabal-version: 1.12
2+
3+-- This file has been generated from package.yaml by hpack version 0.35.1.
4+--
5+-- see: https://github.com/sol/hpack
6+
7+name: katip-rollbar
8+version: 0.3.0.1
9+synopsis: Katip scribe that logs to Rollbar
10+category: Logging
11+homepage: https://github.com/joneshf/katip-rollbar#readme
12+bug-reports: https://github.com/joneshf/katip-rollbar/issues
13+author: Hardy Jones
14+maintainer: jones3.hardy@gmail.com
15+copyright: 2018 Hardy Jones
16+license: BSD3
17+license-file: LICENSE
18+build-type: Simple
19+extra-source-files:
20+ README.md
21+
22+source-repository head
23+ type: git
24+ location: https://github.com/joneshf/katip-rollbar
25+
26+library
27+ exposed-modules:
28+ Katip.Scribes.Rollbar
29+ other-modules:
30+ Paths_katip_rollbar
31+ hs-source-dirs:
32+ src
33+ build-depends:
34+ aeson >=1.2
35+ , async >=2.1
36+ , base >=4.7
37+ , hostname >=1.0
38+ , http-client >=0.5.10
39+ , katip >=0.8
40+ , rollbar-hs >=0.2
41+ , stm-chans >=3.0
42+ , text >=1.2
43+ , time >=1.8
44+ default-language: Haskell2010
package.yamldeleted−24
@@ -1,24 +0,0 @@
1−author: Hardy Jones
2−category: Logging
3−copyright: 2018 Hardy Jones
4−extra-source-files:
5− - README.md
6−github: joneshf/katip-rollbar
7−library:
8− dependencies:
9− - aeson >= 1.2 && < 1.3
10− - async >= 2.1 && < 2.2
11− - base >= 4.7 && < 5
12− - hostname >= 1.0 && < 1.1
13− - http-client >= 0.5.10
14− - katip >= 0.5 && < 0.6
15− - rollbar-hs >= 0.2 && < 0.3
16− - stm-chans >= 3.0 && < 3.1
17− - text >= 1.2 && < 1.3
18− - time >= 1.8 && < 1.9
19− source-dirs: src
20−license: BSD3
21−maintainer: jones3.hardy@gmail.com
22−name: katip-rollbar
23−synopsis: Katip scribe that logs to Rollbar
24−version: '0.2.0.0'
src/Katip/Scribes/Rollbar.hs+21−19
@@ -3,6 +3,7 @@
33{-# LANGUAGE NamedFieldPuns #-}
44{-# LANGUAGE OverloadedStrings #-}
55{-# LANGUAGE PackageImports #-}
6+{-# LANGUAGE RankNTypes #-}
67{-# LANGUAGE ScopedTypeVariables #-}
78{-# LANGUAGE TypeOperators #-}
89
@@ -12,10 +13,10 @@ module Katip.Scribes.Rollbar
1213
1314import Prelude hiding (error)
1415
15−import "base" Control.Monad (replicateM, when)
16−import "base" Data.Foldable (for_)
17−import "base" Data.Functor (void)
18−import "base" GHC.Conc (atomically)
16+import "base" Control.Monad (replicateM, when)
17+import "base" Data.Foldable (for_)
18+import "base" Data.Functor (void)
19+import "base" GHC.Conc (atomically)
1920
2021import "async" Control.Concurrent.Async (async, waitCatch)
2122import "stm-chans" Control.Concurrent.STM.TBMQueue
@@ -31,8 +32,8 @@ import "text" Data.Text.Lazy.Builder (toLazyText)
3132import "time" Data.Time.Clock (UTCTime)
3233import "katip" Katip
3334 ( LogItem
34− , Scribe(Scribe, liPush, scribeFinalizer)
35− , Severity(DebugS, ErrorS, InfoS, NoticeS, WarningS)
35+ , Scribe(..)
36+ , Severity(..)
3637 , Verbosity
3738 , getEnvironment
3839 , itemJson
@@ -44,6 +45,7 @@ import "katip" Katip
4445 , _itemSeverity
4546 , _itemTime
4647 )
48+import "katip" Katip.Core (PermitFunc)
4749import "hostname" Network.HostName (HostName)
4850import "http-client" Network.HTTP.Client (Manager)
4951import "rollbar-hs" Rollbar.AccessToken (AccessToken)
@@ -76,26 +78,26 @@ queueSize = 4096
7678workerSize :: Int
7779workerSize = 10
7880
79−mkRollbarScribe ::
80− RemoveHeaders headers =>
81− proxy headers ->
82− AccessToken ->
83− Maybe Branch ->
84− Maybe CodeVersion ->
85− Manager -> -- ^ Must support TLS
86− Severity ->
87− Verbosity ->
88− IO Scribe
89−mkRollbarScribe proxy accessToken branch codeVersion manager severity verbosity = do
81+mkRollbarScribe
82+ :: RemoveHeaders headers
83+ => proxy headers
84+ -> AccessToken
85+ -> Maybe Branch
86+ -> Maybe CodeVersion
87+ -> Manager -- ^ Must support TLS
88+ -> PermitFunc
89+ -> Verbosity
90+ -> IO Scribe
91+mkRollbarScribe proxy accessToken branch codeVersion manager scribePermitItem verbosity = do
9092 queue <- newTBMQueueIO queueSize
9193 workers <- replicateM workerSize (async $ mkWorker proxy manager queue)
92− let liPush item = when (permitItem severity item) $
94+ let liPush item =
9395 atomically (writeTBMQueue queue $ rollbarItem' item)
9496 rollbarItem' item = rollbarItem proxy accessToken branch codeVersion verbosity item
9597 scribeFinalizer = do
9698 atomically (closeTBMQueue queue)
9799 for_ workers waitCatch
98− pure Scribe { liPush, scribeFinalizer }
100+ pure Scribe { liPush, scribeFinalizer, scribePermitItem }
99101
100102rollbarItem ::
101103 (LogItem a, RemoveHeaders headers) =>
stack.yaml+11−3
@@ -1,6 +1,14 @@
1−flags: {}
1+resolver: lts-20.5
2+
23packages:
34- .
5+
46extra-deps:
5−- rollbar-hs-0.2.0.0
6−resolver: lts-10.5
7+- git: https://github.com/typeable/rollbar-hs.git
8+ commit: cf2e2a5df04b9d1e30dba18d2219b645c3c7b051
9+
10+nix:
11+ packages:
12+ - zlib
13+
14+flags: {}