-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3b5468
commit 2da4a73
Showing
13 changed files
with
140 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
"loglayer": minor | ||
--- | ||
|
||
Add `fatal` log level support | ||
|
||
- Adds the `fatal()` method in `loglayer` to write to a `fatal` | ||
log level. | ||
* Any logging libraries that do not support `fatal` level will | ||
be written as an `error` level instead. |
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 |
---|---|---|
@@ -1,50 +1,53 @@ | ||
import { LogLayer } from '../src/LogLayer' | ||
import type { LogLayer } from "../src"; | ||
|
||
export function testMethods(p: LogLayer) { | ||
console.log('===== info() ====') | ||
p.info('info', 'message', '3') | ||
console.log("===== info() ===="); | ||
p.info("info", "message", "3"); | ||
|
||
console.log('===== warn() ====') | ||
p.warn('warn message %s', 1) | ||
console.log("===== warn() ===="); | ||
p.warn("warn message %s", 1); | ||
|
||
console.log('===== error() ====') | ||
p.error('error message') | ||
console.log("===== error() ===="); | ||
p.error("error message"); | ||
|
||
console.log('===== debug() ====') | ||
p.debug('debug message') | ||
console.log("===== debug() ===="); | ||
p.debug("debug message"); | ||
|
||
console.log('===== trace() ====') | ||
p.trace('trace message') | ||
console.log("===== trace() ===="); | ||
p.trace("trace message"); | ||
|
||
console.log('===== withMetadata() ====') | ||
console.log("===== fatal() ===="); | ||
p.fatal("fatal message"); | ||
|
||
console.log("===== withMetadata() ===="); | ||
p.withMetadata({ | ||
test: 'metadata', | ||
test2: 'metadata2', | ||
}).trace('trace message') | ||
test: "metadata", | ||
test2: "metadata2", | ||
}).trace("trace message"); | ||
|
||
console.log('===== withError() ====') | ||
p.withError(new Error('error object')).trace('trace message') | ||
console.log("===== withError() ===="); | ||
p.withError(new Error("error object")).trace("trace message"); | ||
|
||
console.log('===== withError() + withMetadata() ====') | ||
console.log("===== withError() + withMetadata() ===="); | ||
p.withMetadata({ | ||
test: 'metadata', | ||
test2: 'metadata2', | ||
test: "metadata", | ||
test2: "metadata2", | ||
}) | ||
.withError(new Error('error object')) | ||
.error('error message') | ||
.withError(new Error("error object")) | ||
.error("error message"); | ||
|
||
console.log('===== onlyError() ====') | ||
p.errorOnly(new Error('error message')) | ||
console.log("===== onlyError() ===="); | ||
p.errorOnly(new Error("error message")); | ||
|
||
console.log('===== onlyMetadata() ====') | ||
console.log("===== onlyMetadata() ===="); | ||
p.metadataOnly({ | ||
only: 'metadata', | ||
}) | ||
only: "metadata", | ||
}); | ||
|
||
console.log('===== withContext() ====') | ||
console.log("===== withContext() ===="); | ||
p.withContext({ | ||
test: 'data', | ||
}) | ||
test: "data", | ||
}); | ||
|
||
p.info('context data') | ||
p.info("context data"); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.