Skip to content

Commit 093a01f

Browse files
authored
Merge pull request #69 from KnpLabs/fix/log-timestamps
Fix log timestamps
2 parents db25fe7 + 87871a5 commit 093a01f

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

src/logger.js

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { F, always, bind, equals, findIndex, gte, ifElse, partial, pickAll } from 'ramda'
1+
import { F, always, equals, findIndex, gte, ifElse, pickAll } from 'ramda'
22

33
/**
44
* @type Logger = {
@@ -36,40 +36,28 @@ const loggerHead = type => `[${(new Date()).toISOString()}] ${type.toUpperCase()
3636
// error :: (String, Output) -> Function
3737
const error = (level, output) => ifElse(
3838
level => shouldPrintLog(level, LEVEL_ERROR),
39-
() => partial(
40-
bind(output.error, output),
41-
[loggerHead(LEVEL_ERROR)],
42-
),
39+
() => (...args) => output.error(loggerHead(LEVEL_ERROR), ...args),
4340
always(F),
4441
)(level)
4542

4643
// warn :: (String, Output) -> Function
4744
const warn = (level, output) => ifElse(
4845
level => shouldPrintLog(level, LEVEL_WARN),
49-
() => partial(
50-
bind(output.warn, output),
51-
[loggerHead(LEVEL_WARN)],
52-
),
46+
() => (...args) => output.warn(loggerHead(LEVEL_WARN), ...args),
5347
always(F),
5448
)(level)
5549

5650
// info :: (String, Output) -> Function
5751
const info = (level, output) => ifElse(
5852
level => shouldPrintLog(level, LEVEL_INFO),
59-
() => partial(
60-
bind(output.info, output),
61-
[loggerHead(LEVEL_INFO)],
62-
),
53+
() => (...args) => output.info(loggerHead(LEVEL_INFO), ...args),
6354
always(F),
6455
)(level)
6556

6657
// debug :: (String, Output) -> Function
6758
const debug = (level, output) => ifElse(
6859
level => shouldPrintLog(level, LEVEL_DEBUG),
69-
() => partial(
70-
bind(output.log, output),
71-
[loggerHead(LEVEL_DEBUG)],
72-
),
60+
() => (...args) => output.log(loggerHead(LEVEL_DEBUG), ...args),
7361
always(F),
7462
)(level)
7563

0 commit comments

Comments
 (0)