Skip to content

Commit cf0d3e7

Browse files
committed
Issue #109: Update documentation for LogLevel.Off
1 parent 2ff3e83 commit cf0d3e7

File tree

5 files changed

+29
-8
lines changed

5 files changed

+29
-8
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ TypeScript logging can be used to add logging to your web or node project.
55
**_Version 2 of typescript-logging has been released, this version has been written from scratch and is
66
not compatible with version 1 (see migration)._**
77

8-
There are two different flavors available to use. Please visit the documentation below and pick the one you prefer.
8+
There are two different flavors available to use. Please visit the documentation of the links below and pick the one you
9+
prefer.
910

1011
* The [typescript-logging-category-style](./category-style/README.MD) flavor.
1112
* The [typescript-logging-log4ts-style](./log4ts-style/README.MD) flavor.
1213

13-
The following general sections are available:
14+
The following sections are available:
1415

1516
* [Getting started](#getting-started)
1617
* [Build](#build)

category-style/README.MD

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,12 @@ A logger can log on different `LogLevels`:
149149
- Warn
150150
- Error
151151
- Fatal
152+
- Off
152153

153-
Each level has a matching function on the Logger, for example `trace` for Trace and `debug` for Debug. The signatures of
154-
the function are the same for all of them. This shows the signatures for debug.
154+
Each level except 'Off' has a matching function on the Logger, for example `trace` for Trace and `debug` for Debug. The
155+
signatures of the function are the same for all of them. Note that the level 'Off' turns logging off completely.
156+
157+
This shows the signatures for debug.
155158

156159
```typescript
157160
interface CoreLogger {

documentation/change_log.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
This page describes the relevant changes per version since 2.0.0 release.
44

55
* 2.1.0
6+
* Add support for LogLevel.Off, this allows logging to be turned off complete.
7+
Issue https://github.com/vauxite-org/typescript-logging/issues/109. Please be sure to
8+
read the [migration guide](./migration.md) as this change may have an effect.
69
* Dev dependencies updated (to get rid of vulnerability warnings), these have no influence on the production
710
release and are used during the build only.
811

documentation/migration.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
This section provides an overview of breaking changes, when migrating from an older typescript-logging version.
44

5+
## Version 2.0.x -> 2.1.x
6+
7+
Enum value LogLevel.Off has been added. It is unlikely to cause a problem to existing code, however if you
8+
do switch on LogLevel in the code somewhere and/or check on LogLevel, the compilation of your project may fail
9+
or the logic is now wrong.
10+
11+
To find out if you do, you can search for '.logLevel' (it is a property on a logger).
12+
513
## Version 1.0.x -> 2.0.x
614

715
As version 2 is a complete rewrite from scratch there is no direct migration path although certain things are still

log4ts-style/README.MD

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,12 @@ A logger can log on different `LogLevels`:
137137
- Warn
138138
- Error
139139
- Fatal
140+
- Off
140141

141-
Each level has a matching function on the Logger, for example `trace` for Trace and `debug` for Debug. The signatures of
142-
the function are the same for all of them. This shows the signatures for debug.
142+
Each level except 'Off' has a matching function on the Logger, for example `trace` for Trace and `debug` for Debug. The
143+
signatures of the function are the same for all of them. Note that the level 'Off' turns logging off completely.
144+
145+
This shows the signatures for debug.
143146

144147
```typescript
145148
interface CoreLogger {
@@ -177,7 +180,8 @@ A Log4TSProvider created without any options logs on `LogLevel.Error` and uses a
177180
console. Messages are formatted in a default sane format (see above for an example).
178181

179182
This code snippet creates a Log4TSProvider with default settings, the `groups` property is required to be specified and
180-
in this case we match every namespace. Note we also specify an identifier, it is recommended to specify the identifier if
183+
in this case we match every namespace. Note we also specify an identifier, it is recommended to specify the identifier
184+
if
181185
you intend to make use of the dynamic control (see in later sections).
182186

183187
```typescript
@@ -302,7 +306,9 @@ export interface LogChannel {
302306
}
303307
```
304308

305-
Essentially it expects you to provide the `write` function. The `type` (a [discriminating union](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions)) is solely there to
309+
Essentially it expects you to provide the `write` function. The `type` (
310+
a [discriminating union](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions)) is solely
311+
there to
306312
distinguish between the different channels and is always `"LogChannel"` for a `LogChannel`. The write function is called
307313
with for each `LogMessage`, and contains a message and optional error (formatted as stack). We have
308314
already seen how to create a custom LogChannel in the previous section (have a look above if you didn't read it yet).

0 commit comments

Comments
 (0)