Skip to content

Commit 6fb7198

Browse files
committed
Split package into co-log-json and cheops-logger
* co-log-json - generic structured logging library * cheops-logger - all-in-one logging libary
1 parent b875a0e commit 6fb7198

File tree

24 files changed

+828
-298
lines changed

24 files changed

+828
-298
lines changed

.github/workflows/haskell.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install dependencies
3434
run: |
3535
cabal update
36-
cabal build --only-dependencies --enable-tests --enable-benchmarks cheops-logger
36+
cabal build --only-dependencies --enable-tests --enable-benchmarks co-log-json cheops-logger
3737
- name: Build
3838
run: cabal build --enable-tests --enable-benchmarks all
3939
- name: Run tests

Readme.markdown

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
# Cheops-logger
22

3-
Logger library for structured logging. This library is a light extension of the
4-
[co-log-concurrent](https://hackage.haskell.org/packages/co-log-concurrent) package.
5-
That allows to have asynchronous structured logs writing.
3+
* co-log-json - structured logging library
64

7-
8-
## Installation
9-
10-
## Tutorial
11-
12-
### Adding package
13-
14-
### Initialization
15-
16-
### Context
5+
* cheops-logger - full featured logging library
176

cabal.project

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
packages: .
1+
packages:
2+
co-log-json
3+
cheops-logger
4+
examples
25

36
source-repository-package
47
type: git

cheops-logger.cabal

Lines changed: 0 additions & 160 deletions
This file was deleted.

cheops-logger/ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Revision history for cheops-logger
2+
3+
## 0.0.1.0 -- 2020-10-22
4+
5+
* First published version.
File renamed without changes.
File renamed without changes.

cheops-logger/cheops-logger.cabal

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
cabal-version: 3.0
2+
name: cheops-logger
3+
version: 0.0.1.0
4+
synopsis: Structured logger implementation.
5+
description:
6+
7+
In addition the package provides an @cheops-logger@ library that can be used in the application
8+
as-is to log all messages. The library is combines:
9+
10+
* asynchronous background logging using [co-log-concurrent](https://hackage.haskell.org/package/co-log-concurrent);
11+
* configuration using [yaml](https://hackage.haskell.org/package/yaml);
12+
* optional metrics support
13+
14+
15+
license: MPL-2.0
16+
license-file: LICENSE
17+
author: Alexander Vershilov
18+
maintainer: [email protected]
19+
copyright: (C) 2019-2020 Фонд "Талант и Успех"
20+
category: System
21+
build-type: Simple
22+
extra-source-files: ChangeLog.md
23+
24+
library metrics-prometheus
25+
default-language: Haskell2010
26+
visibility: public
27+
exposed-modules:
28+
Cheops.Logger.Internal.Metric.Prometheus
29+
reexported-modules:
30+
Cheops.Logger.Internal.Metric.Prometheus as Cheops.Logger.Metrics
31+
hs-source-dirs: src
32+
default-extensions:
33+
OverloadedStrings
34+
build-depends:
35+
base >= 4.11 && <5
36+
, prometheus-client ^>= 1.0
37+
, prometheus-client-extra ^>=0.1
38+
, text ^>=1.2
39+
40+
library metrics-noop
41+
visibility: public
42+
exposed-modules:
43+
Cheops.Logger.Internal.Metric.Noop
44+
hs-source-dirs: src
45+
default-language: Haskell2010
46+
build-depends:
47+
base >= 4.11 && <5
48+
49+
50+
library
51+
default-language: Haskell2010
52+
exposed-modules:
53+
Cheops.Logger
54+
default-extensions:
55+
ImportQualifiedPost
56+
RecordWildCards
57+
OverloadedStrings
58+
hs-source-dirs:
59+
src
60+
signatures: Cheops.Logger.Metrics
61+
build-depends:
62+
base >= 4.11 && <5
63+
, aeson ^>= 1.5
64+
, co-log-core
65+
, co-log-json ^>=0.0
66+
, co-log-concurrent ^>=0.5
67+
, stm ^>=2.5
68+
ghc-options: -Wall -Werror
69+

logger/Cheops/Logger.hs renamed to cheops-logger/src/Cheops/Logger.hs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,15 @@ module Cheops.Logger
2626
withLogger
2727
, defCapacity
2828
, LoggerConfig(..)
29-
, module Cheops.Logger.Structured
29+
, module Colog.Json
3030
-- * Metrics support
3131
-- $metrics-support
3232
-- $setup
3333
) where
3434

3535
import Cheops.Logger.Metrics (flushLog, submitLog)
36-
import Cheops.Logger.Internal.Structured
37-
import Cheops.Logger.Internal.Writer
38-
import Cheops.Logger.Structured
36+
import Colog.Json
37+
import Colog.Json.Action
3938
import Colog.Concurrent
4039
import Colog.Concurrent.Internal
4140
import Colog.Core hiding (Severity, Info)
@@ -76,7 +75,7 @@ withLogger LoggerConfig{..} f
7675
$ \(LogAction log_action) ->
7776
f $ mkLogger (LogAction $ submitLog . log_action)
7877
where
79-
LogAction feed = feedHandle stdout
78+
LogAction feed = logToHandle stdout
8079

8180

8281

File renamed without changes.

0 commit comments

Comments
 (0)