-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.cjs
64 lines (57 loc) · 2.15 KB
/
index.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const EventEmitter = require('events')
const os = require('os')
const blueprint = require('@polyn/blueprint')
const immutable = require('@polyn/immutable')
// formatters
const { ConsoleStyles } = require('./src/formatters/ConsoleStyles').factory(blueprint, immutable)
const { validateFormatter } = require('./src/formatters/validate-formatter').factory(blueprint)
const { errorFormatter } = require('./src/formatters/error-formatter').factory(blueprint)
const { BlockFormatter } = require('./src/formatters/BlockFormatter').factory(ConsoleStyles)
const { BunyanFormatter } = require('./src/formatters/BunyanFormatter').factory(errorFormatter)
const { JsonFormatter } = require('./src/formatters/JsonFormatter').factory(blueprint, errorFormatter)
const { PassThroughFormatter } = require('./src/formatters/PassThroughFormatter').factory()
const { StringFormatter } = require('./src/formatters/StringFormatter').factory(blueprint, errorFormatter)
const { SquashFormatter } = require('./src/formatters/SquashFormatter')({ blueprint })
const formatters = {
BlockFormatter,
BunyanFormatter,
JsonFormatter,
PassThroughFormatter,
StringFormatter,
SquashFormatter,
}
// writers
const { ArrayWriter } = require('./src/writers/ArrayWriter').factory(validateFormatter)
const { ConsoleWriter } = require('./src/writers/ConsoleWriter').factory(validateFormatter)
const { DevConsoleWriter } = require('./src/writers/DevConsoleWriter').factory(validateFormatter)
const { StdoutWriter } = require('./src/writers/StdoutWriter').factory(validateFormatter)
const writers = {
ArrayWriter,
ConsoleWriter,
DevConsoleWriter,
StdoutWriter,
}
// middleware / utils
const { makeId } = require('./src/make-id')()
const time = require('./src/time')()
const { makeTryWithMetrics, METRICS_CATEGORIES } = require('./src/try-with-metrics')({
blueprint,
immutable,
makeId,
time,
})
// logger
const { LogMetaFactory } = require('./src/LogMetaFactory')({ blueprint, immutable, os })
const { LogEmitter } = require('./src/LogEmitter')({
blueprint,
immutable,
EventEmitter,
LogMetaFactory,
makeTryWithMetrics,
})
module.exports = {
formatters,
writers,
LogEmitter,
METRICS_CATEGORIES,
}