-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* separate package Blammo-wai * drop LTS 14 * update license year for Blammo
- Loading branch information
1 parent
d72bd97
commit a4b38aa
Showing
23 changed files
with
757 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
cabal-version: 1.18 | ||
|
||
-- This file has been generated from package.yaml by hpack version 0.36.0. | ||
-- | ||
-- see: https://github.com/sol/hpack | ||
|
||
name: Blammo-wai | ||
version: 0.0.0.0 | ||
synopsis: Using Blammo with WAI | ||
description: Please see README.md | ||
category: Logging, Web | ||
homepage: https://github.com/freckle/blammo#readme | ||
bug-reports: https://github.com/freckle/blammo/issues | ||
maintainer: Freckle Education | ||
license: MIT | ||
license-file: LICENSE | ||
build-type: Simple | ||
extra-doc-files: | ||
README.md | ||
CHANGELOG.md | ||
|
||
source-repository head | ||
type: git | ||
location: https://github.com/freckle/blammo | ||
|
||
library | ||
exposed-modules: | ||
Network.Wai.Middleware.Logging | ||
other-modules: | ||
Paths_Blammo_wai | ||
hs-source-dirs: | ||
src | ||
default-extensions: | ||
DerivingStrategies | ||
GeneralizedNewtypeDeriving | ||
LambdaCase | ||
NoImplicitPrelude | ||
OverloadedStrings | ||
RecordWildCards | ||
TypeApplications | ||
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 | ||
build-depends: | ||
Blammo | ||
, aeson | ||
, base <5 | ||
, bytestring | ||
, case-insensitive | ||
, clock | ||
, http-types | ||
, text | ||
, unliftio-core | ||
, wai | ||
default-language: Haskell2010 | ||
if impl(ghc >= 9.8) | ||
ghc-options: -Wno-missing-role-annotations | ||
if impl(ghc >= 9.2) | ||
ghc-options: -Wno-missing-kind-signatures | ||
if impl(ghc >= 8.10) | ||
ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module | ||
|
||
test-suite readme | ||
type: exitcode-stdio-1.0 | ||
main-is: README.lhs | ||
other-modules: | ||
Paths_Blammo_wai | ||
default-extensions: | ||
DerivingStrategies | ||
GeneralizedNewtypeDeriving | ||
LambdaCase | ||
NoImplicitPrelude | ||
OverloadedStrings | ||
RecordWildCards | ||
TypeApplications | ||
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 | ||
build-depends: | ||
Blammo | ||
, Blammo-wai | ||
, aeson | ||
, base <5 | ||
, lens | ||
, markdown-unlit | ||
, text | ||
, wai | ||
, warp | ||
, yesod-core | ||
default-language: Haskell2010 | ||
if impl(ghc >= 9.8) | ||
ghc-options: -Wno-missing-role-annotations | ||
if impl(ghc >= 9.2) | ||
ghc-options: -Wno-missing-kind-signatures | ||
if impl(ghc >= 8.10) | ||
ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## [_Unreleased_](https://github.com/freckle/blammo/compare/v0.0.0.1...main) | ||
|
||
## [v0.0.0.1](https://github.com/freckle/blammo/compare/0.0.0.0...v0.0.0.1) | ||
|
||
... | ||
|
||
## [v0.0.0.0](https://github.com/freckle/blammo/tree/v0.0.0.0) | ||
|
||
First release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2022-2024 Renaissance Learning Inc | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Blammo-wai | ||
|
||
Integration of [Blammo](https://hackage.haskell.org/package/Blammo) | ||
with [wai](https://hackage.haskell.org/package/wai). | ||
|
||
<!-- | ||
```haskell | ||
{-# LANGUAGE DeriveAnyClass #-} | ||
{-# LANGUAGE DeriveGeneric #-} | ||
{-# LANGUAGE DerivingVia #-} | ||
{-# LANGUAGE EmptyCase #-} | ||
{-# LANGUAGE EmptyDataDeriving #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
module Main (module Main) where | ||
import Prelude | ||
import Control.Exception (displayException) | ||
import Control.Monad (when) | ||
import Data.Aeson | ||
import Data.Text (Text) | ||
import Text.Markdown.Unlit () | ||
import Control.Lens (lens) | ||
``` | ||
--> | ||
```haskell | ||
-- Blammo | ||
import Blammo.Logging | ||
-- wai | ||
import Network.Wai (Middleware) | ||
-- Blammo-wai | ||
import Network.Wai.Middleware.Logging | ||
-- warp | ||
import qualified Network.Wai.Handler.Warp as Warp | ||
-- yesod | ||
import Yesod.Core (Yesod) | ||
import qualified Yesod.Core as Yesod | ||
``` | ||
<!-- | ||
```haskell | ||
main :: IO () | ||
main = pure () | ||
``` | ||
--> | ||
```haskell | ||
data App = App | ||
{ appLogger :: Logger | ||
-- etc. | ||
} | ||
instance HasLogger App where | ||
loggerL = lens appLogger $ \x y -> x {appLogger = y} | ||
``` | ||
## Integration with WAI | ||
```haskell | ||
waiMiddleware :: App -> Middleware | ||
waiMiddleware app = | ||
addThreadContext ["app" .= ("my-app" :: Text)] | ||
. requestLogger app | ||
. Yesod.defaultMiddlewaresNoLogging | ||
``` | ||
## Integration with Warp | ||
```haskell | ||
warpSettings :: App -> Warp.Settings | ||
warpSettings app = Warp.setOnException onEx $ Warp.defaultSettings | ||
where | ||
onEx _req ex = | ||
when (Warp.defaultShouldDisplayException ex) | ||
$ runWithLogger app | ||
$ logError | ||
$ "Warp exception" :# ["exception" .= displayException ex] | ||
``` | ||
## Integration with Yesod | ||
<!-- | ||
```haskell | ||
instance Yesod.RenderRoute App where | ||
data Route App deriving stock Eq | ||
renderRoute = \case{} | ||
``` | ||
--> | ||
```haskell | ||
instance Yesod App where | ||
messageLoggerSource app _logger loc source level msg = | ||
runWithLogger app $ monadLoggerLog loc source level msg | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
README.lhs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Blammo-wai | ||
version: 0.0.0.0 | ||
maintainer: Freckle Education | ||
category: Logging, Web | ||
github: freckle/blammo | ||
synopsis: Using Blammo with WAI | ||
description: Please see README.md | ||
|
||
extra-doc-files: | ||
- README.md | ||
- CHANGELOG.md | ||
|
||
ghc-options: | ||
- -Weverything | ||
- -Wno-all-missed-specialisations | ||
- -Wno-missing-exported-signatures # re-enables missing-signatures | ||
- -Wno-missing-import-lists | ||
- -Wno-missing-local-signatures | ||
- -Wno-monomorphism-restriction | ||
- -Wno-safe | ||
- -Wno-unsafe | ||
|
||
when: | ||
- condition: "impl(ghc >= 9.8)" | ||
ghc-options: | ||
- -Wno-missing-role-annotations | ||
- condition: "impl(ghc >= 9.2)" | ||
ghc-options: | ||
- -Wno-missing-kind-signatures | ||
- condition: "impl(ghc >= 8.10)" | ||
ghc-options: | ||
- -Wno-missing-safe-haskell-mode | ||
- -Wno-prepositive-qualified-module | ||
|
||
dependencies: | ||
- base < 5 | ||
|
||
default-extensions: | ||
- DerivingStrategies | ||
- GeneralizedNewtypeDeriving | ||
- LambdaCase | ||
- NoImplicitPrelude | ||
- OverloadedStrings | ||
- RecordWildCards | ||
- TypeApplications | ||
|
||
library: | ||
source-dirs: src | ||
dependencies: | ||
- aeson | ||
- Blammo | ||
- bytestring | ||
- case-insensitive | ||
- clock | ||
- http-types | ||
- text | ||
- unliftio-core | ||
- wai | ||
|
||
tests: | ||
readme: | ||
main: README.lhs | ||
ghc-options: -pgmL markdown-unlit | ||
dependencies: | ||
- Blammo | ||
- Blammo-wai | ||
- aeson | ||
- lens | ||
- markdown-unlit | ||
- text | ||
- wai | ||
- warp | ||
- yesod-core |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.