Skip to content

Commit 2959245

Browse files
committed
v1.1.0
# 1.1.0 - 2022-05-24 ### Added - Custom type now passed to `logLevel` The `LogLevel` can be calculated from the custom type that's now passed to it. This argument can be ignored if you don't require it ### Changed - README now correctly shows `extraDetails` as optional in the example and in the information - The README example now shows also shows off the new argument passed to `logLevel(T)`
1 parent 3fd3061 commit 2959245

File tree

4 files changed

+1626
-216
lines changed

4 files changed

+1626
-216
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,19 @@ All notable changes to this project will be documented in this file.
2626
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2727
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2828

29+
## [1.1.0] - 2022-05-24
30+
31+
### Added
32+
- Custom type now passed to `logLevel`
33+
The `LogLevel` can be calculated from the custom type that's now passed to it. This argument can be ignored if you don't require it
34+
35+
### Changed
36+
- README now correctly shows `extraDetails` as optional in the example and in the information
37+
- The README example now shows also shows off the new argument passed to `logLevel(T)`
38+
2939
## [1.0.0] - 2022-05-12
3040

3141
**This was the first release**
3242

43+
[1.1.0]: https://github.com/topmarksdevelopment/Javascript.Logger/compare/v1.0.0...v1.1.0
3344
[1.0.0]: https://github.com/topmarksdevelopment/Javascript.Logger/release/tag/v1.0.0

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ Then provide the body for the two functions and also the 'type' for the `extraDe
1414
```TS
1515
interface ExtraInfo {
1616
error?: unknown
17+
logLevelForNow?: LogLevel
1718
}
1819

1920
class MyLogger extends JavascriptLogger<ExtraInfo> {
20-
logLevel = (): LogLevel => LogLevel.warn;
21+
logLevel = (extraDetails?: ExtraInfo): LogLevel =>
22+
extraDetails?.logLevelForNow ?? LogLevel.warn;
2123

22-
logIt = (logLevel: LogLevel, title: string, message?: string | string[], extraDetails: ExtraInfo): void => {
24+
logIt = (logLevel: LogLevel, title: string, message?: string | string[], extraDetails?: ExtraInfo): void => {
2325
// consume the information and do stuff
2426
};
2527
}
@@ -55,14 +57,14 @@ function thisWillAlwaysWork() {
5557

5658
This specifies the log level to start outputting the messages
5759

58-
**Arguments:** _NONE_
60+
**Arguments:** extraDetails?: `T`_(custom type)_
5961
**Output:** `LogLevel` (_`critical`, `error`, `warn`, `info`, `debug`, `trace`_)
6062

6163
### `logIt`
6264

6365
This is the function that is called when a log occurs that meets the minimum log level specified by `logLevel`
6466

65-
**Arguments:** logLevel: `LogLevel`, title: `string`, message?: `string | string[]`, extraDetails: `T`_(custom type)_
67+
**Arguments:** logLevel: `LogLevel`, title: `string`, message?: `string | string[]`, extraDetails?: `T`_(custom type)_
6668
**Output:** _NONE_
6769

6870
## Built in components

0 commit comments

Comments
 (0)