Skip to content

Commit a4b38aa

Browse files
authoredJul 22, 2024
separate package Blammo-wai (#49)
* separate package Blammo-wai * drop LTS 14 * update license year for Blammo
1 parent d72bd97 commit a4b38aa

23 files changed

+757
-171
lines changed
 

‎.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
- uses: haskell-actions/hlint-run@v2
3939
with:
4040
fail-on: warning
41-
path: '["Blammo/src/", "Blammo/tests/"]'
41+
path: '["Blammo/src/", "Blammo/tests/", "Blammo-wai/src/"]'

‎.github/workflows/release.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
matrix:
1313
package:
1414
- Blammo
15+
- Blammo-wai
1516

1617
steps:
1718
- uses: actions/checkout@v4
@@ -30,4 +31,4 @@ jobs:
3031
working-directory: ${{ matrix.package }}
3132
env:
3233
HACKAGE_KEY: ${{ secrets.HACKAGE_UPLOAD_API_KEY }}
33-
STACK_YAML: ../stack-lts-14.27.yaml
34+
STACK_YAML: ../stack-lts-16.31.yaml

‎Blammo-wai/Blammo-wai.cabal

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
cabal-version: 1.18
2+
3+
-- This file has been generated from package.yaml by hpack version 0.36.0.
4+
--
5+
-- see: https://github.com/sol/hpack
6+
7+
name: Blammo-wai
8+
version: 0.0.0.0
9+
synopsis: Using Blammo with WAI
10+
description: Please see README.md
11+
category: Logging, Web
12+
homepage: https://github.com/freckle/blammo#readme
13+
bug-reports: https://github.com/freckle/blammo/issues
14+
maintainer: Freckle Education
15+
license: MIT
16+
license-file: LICENSE
17+
build-type: Simple
18+
extra-doc-files:
19+
README.md
20+
CHANGELOG.md
21+
22+
source-repository head
23+
type: git
24+
location: https://github.com/freckle/blammo
25+
26+
library
27+
exposed-modules:
28+
Network.Wai.Middleware.Logging
29+
other-modules:
30+
Paths_Blammo_wai
31+
hs-source-dirs:
32+
src
33+
default-extensions:
34+
DerivingStrategies
35+
GeneralizedNewtypeDeriving
36+
LambdaCase
37+
NoImplicitPrelude
38+
OverloadedStrings
39+
RecordWildCards
40+
TypeApplications
41+
ghc-options: -Weverything -Wno-all-missed-specialisations -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-safe -Wno-unsafe
42+
build-depends:
43+
Blammo
44+
, aeson
45+
, base <5
46+
, bytestring
47+
, case-insensitive
48+
, clock
49+
, http-types
50+
, text
51+
, unliftio-core
52+
, wai
53+
default-language: Haskell2010
54+
if impl(ghc >= 9.8)
55+
ghc-options: -Wno-missing-role-annotations
56+
if impl(ghc >= 9.2)
57+
ghc-options: -Wno-missing-kind-signatures
58+
if impl(ghc >= 8.10)
59+
ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module
60+
61+
test-suite readme
62+
type: exitcode-stdio-1.0
63+
main-is: README.lhs
64+
other-modules:
65+
Paths_Blammo_wai
66+
default-extensions:
67+
DerivingStrategies
68+
GeneralizedNewtypeDeriving
69+
LambdaCase
70+
NoImplicitPrelude
71+
OverloadedStrings
72+
RecordWildCards
73+
TypeApplications
74+
ghc-options: -Weverything -Wno-all-missed-specialisations -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-safe -Wno-unsafe -pgmL markdown-unlit
75+
build-depends:
76+
Blammo
77+
, Blammo-wai
78+
, aeson
79+
, base <5
80+
, lens
81+
, markdown-unlit
82+
, text
83+
, wai
84+
, warp
85+
, yesod-core
86+
default-language: Haskell2010
87+
if impl(ghc >= 9.8)
88+
ghc-options: -Wno-missing-role-annotations
89+
if impl(ghc >= 9.2)
90+
ghc-options: -Wno-missing-kind-signatures
91+
if impl(ghc >= 8.10)
92+
ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module

‎Blammo-wai/CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## [_Unreleased_](https://github.com/freckle/blammo/compare/v0.0.0.1...main)
2+
3+
## [v0.0.0.1](https://github.com/freckle/blammo/compare/0.0.0.0...v0.0.0.1)
4+
5+
...
6+
7+
## [v0.0.0.0](https://github.com/freckle/blammo/tree/v0.0.0.0)
8+
9+
First release

‎Blammo-wai/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022-2024 Renaissance Learning Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎Blammo-wai/README.lhs

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Blammo-wai
2+
3+
Integration of [Blammo](https://hackage.haskell.org/package/Blammo)
4+
with [wai](https://hackage.haskell.org/package/wai).
5+
6+
<!--
7+
```haskell
8+
{-# LANGUAGE DeriveAnyClass #-}
9+
{-# LANGUAGE DeriveGeneric #-}
10+
{-# LANGUAGE DerivingVia #-}
11+
{-# LANGUAGE EmptyCase #-}
12+
{-# LANGUAGE EmptyDataDeriving #-}
13+
{-# LANGUAGE TypeFamilies #-}
14+
15+
module Main (module Main) where
16+
17+
import Prelude
18+
19+
import Control.Exception (displayException)
20+
import Control.Monad (when)
21+
import Data.Aeson
22+
import Data.Text (Text)
23+
import Text.Markdown.Unlit ()
24+
import Control.Lens (lens)
25+
```
26+
-->
27+
28+
```haskell
29+
-- Blammo
30+
import Blammo.Logging
31+
32+
-- wai
33+
import Network.Wai (Middleware)
34+
35+
-- Blammo-wai
36+
import Network.Wai.Middleware.Logging
37+
38+
-- warp
39+
import qualified Network.Wai.Handler.Warp as Warp
40+
41+
-- yesod
42+
import Yesod.Core (Yesod)
43+
import qualified Yesod.Core as Yesod
44+
```
45+
46+
<!--
47+
```haskell
48+
main :: IO ()
49+
main = pure ()
50+
```
51+
-->
52+
53+
```haskell
54+
data App = App
55+
{ appLogger :: Logger
56+
-- etc.
57+
}
58+
59+
instance HasLogger App where
60+
loggerL = lens appLogger $ \x y -> x {appLogger = y}
61+
```
62+
63+
## Integration with WAI
64+
65+
```haskell
66+
waiMiddleware :: App -> Middleware
67+
waiMiddleware app =
68+
addThreadContext ["app" .= ("my-app" :: Text)]
69+
. requestLogger app
70+
. Yesod.defaultMiddlewaresNoLogging
71+
```
72+
73+
## Integration with Warp
74+
75+
```haskell
76+
warpSettings :: App -> Warp.Settings
77+
warpSettings app = Warp.setOnException onEx $ Warp.defaultSettings
78+
where
79+
onEx _req ex =
80+
when (Warp.defaultShouldDisplayException ex)
81+
$ runWithLogger app
82+
$ logError
83+
$ "Warp exception" :# ["exception" .= displayException ex]
84+
```
85+
86+
## Integration with Yesod
87+
88+
<!--
89+
```haskell
90+
instance Yesod.RenderRoute App where
91+
data Route App deriving stock Eq
92+
renderRoute = \case{}
93+
```
94+
-->
95+
96+
```haskell
97+
instance Yesod App where
98+
messageLoggerSource app _logger loc source level msg =
99+
runWithLogger app $ monadLoggerLog loc source level msg
100+
```

‎Blammo-wai/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
README.lhs

‎Blammo-wai/package.yaml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Blammo-wai
2+
version: 0.0.0.0
3+
maintainer: Freckle Education
4+
category: Logging, Web
5+
github: freckle/blammo
6+
synopsis: Using Blammo with WAI
7+
description: Please see README.md
8+
9+
extra-doc-files:
10+
- README.md
11+
- CHANGELOG.md
12+
13+
ghc-options:
14+
- -Weverything
15+
- -Wno-all-missed-specialisations
16+
- -Wno-missing-exported-signatures # re-enables missing-signatures
17+
- -Wno-missing-import-lists
18+
- -Wno-missing-local-signatures
19+
- -Wno-monomorphism-restriction
20+
- -Wno-safe
21+
- -Wno-unsafe
22+
23+
when:
24+
- condition: "impl(ghc >= 9.8)"
25+
ghc-options:
26+
- -Wno-missing-role-annotations
27+
- condition: "impl(ghc >= 9.2)"
28+
ghc-options:
29+
- -Wno-missing-kind-signatures
30+
- condition: "impl(ghc >= 8.10)"
31+
ghc-options:
32+
- -Wno-missing-safe-haskell-mode
33+
- -Wno-prepositive-qualified-module
34+
35+
dependencies:
36+
- base < 5
37+
38+
default-extensions:
39+
- DerivingStrategies
40+
- GeneralizedNewtypeDeriving
41+
- LambdaCase
42+
- NoImplicitPrelude
43+
- OverloadedStrings
44+
- RecordWildCards
45+
- TypeApplications
46+
47+
library:
48+
source-dirs: src
49+
dependencies:
50+
- aeson
51+
- Blammo
52+
- bytestring
53+
- case-insensitive
54+
- clock
55+
- http-types
56+
- text
57+
- unliftio-core
58+
- wai
59+
60+
tests:
61+
readme:
62+
main: README.lhs
63+
ghc-options: -pgmL markdown-unlit
64+
dependencies:
65+
- Blammo
66+
- Blammo-wai
67+
- aeson
68+
- lens
69+
- markdown-unlit
70+
- text
71+
- wai
72+
- warp
73+
- yesod-core

‎Blammo/Blammo.cabal

+2-7
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ cabal-version: 1.18
55
-- see: https://github.com/sol/hpack
66

77
name: Blammo
8-
version: 1.2.1.0
8+
version: 2.0.0.0
99
synopsis: Batteries-included Structured Logging library
1010
description: Please see README.md
11-
category: Utils
11+
category: Logging
1212
homepage: https://github.com/freckle/blammo#readme
1313
bug-reports: https://github.com/freckle/blammo/issues
1414
maintainer: Freckle Education
@@ -38,7 +38,6 @@ library
3838
Blammo.Logging.Test
3939
Blammo.Logging.WithLogger
4040
Data.Aeson.Compat
41-
Network.Wai.Middleware.Logging
4241
System.Log.FastLogger.Compat
4342
other-modules:
4443
Paths_Blammo
@@ -57,14 +56,11 @@ library
5756
aeson
5857
, base <5
5958
, bytestring
60-
, case-insensitive
61-
, clock
6259
, containers
6360
, dlist
6461
, envparse
6562
, exceptions
6663
, fast-logger >=3.2.3
67-
, http-types
6864
, lens
6965
, monad-logger-aeson
7066
, mtl
@@ -74,7 +70,6 @@ library
7470
, unliftio-core
7571
, unordered-containers
7672
, vector
77-
, wai
7873
default-language: Haskell2010
7974
if impl(ghc >= 9.8)
8075
ghc-options: -Wno-missing-role-annotations

‎Blammo/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## [_Unreleased_](https://github.com/freckle/blammo/compare/v1.2.1.0...main)
22

3+
## [v2.0.0.0](https://github.com/freckle/blammo/compare/v1.2.1.0...v2.0.0.0)
4+
5+
- Remove module `Network.Wai.Middleware.Logging`. It is moved to a new
6+
package, `Blammo-wai`.
7+
38
## [v1.2.1.0](https://github.com/freckle/blammo/compare/1.2.0.0...v1.2.1.0)
49

510
- Add `Blammo.Logging.Simple.withLoggerEnv`

‎Blammo/LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2022 Renaissance Learning Inc
3+
Copyright (c) 2022-2024 Renaissance Learning Inc
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)