Skip to content

Commit 5522deb

Browse files
authored
Merge pull request #46 from MBurchard/update-exports-for-deno
Improve exports for Deno
2 parents 1e5926a + 4996474 commit 5522deb

File tree

3 files changed

+801
-968
lines changed

3 files changed

+801
-968
lines changed

README.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# bit-log: Yet another logging library for Typescript (and Javascript)
1+
# bit-log: Yet another logging library for TypeScript (and JavaScript)
22

33
![lang: Typescript](https://img.shields.io/badge/crafted_with-Typescript-blue?logo=typescript)
44
![GitHub License](https://img.shields.io/github/license/mburchard/bit-log)
@@ -21,8 +21,8 @@ try {
2121

2222
### Configuration
2323

24-
The configuration can be carried out at any time while the code is running, multiple calls and therefore changes are
25-
also possible.
24+
The logging system can be reconfigured at any time during execution. Repeated calls allow dynamic changes to the
25+
configuration.
2626

2727
Logging is configured as follows by default:
2828

@@ -43,7 +43,7 @@ configureLogging({
4343
#### The Call Site
4444

4545
In some environments one wants to know where the log event was created.
46-
Since version 0.8.0 the call site is supported.
46+
Since version 0.8.0, the call site is supported.
4747
Since this is a bit expensive, as the stack trace must be created, it is not activated by default.
4848
To enable it, you can use the property `includeCallSite`.
4949

@@ -62,9 +62,7 @@ configureLogging({
6262
});
6363
```
6464

65-
As always, it can be set at any time and for any Logger. The choice is yours.
66-
Bear in mind, if you set it too late for the root logger, it will not be available for the loggers that are created
67-
before.
65+
As always, it can be set at any time and for any Logger. The choice is yours.
6866

6967
#### Additional Loggers
7068

@@ -80,7 +78,7 @@ configureLogging({
8078
});
8179
```
8280

83-
After this configuration you have 3 loggers, all of which can be used as required.
81+
After this configuration you have three loggers, all of which can be used as required.
8482

8583
```javascript
8684
const log = useLog(); // get the root logger
@@ -97,7 +95,7 @@ You can also change the level when accessing a logger. However, it is not recomm
9795
the configuration across the entire code base. Log levels should be configured centrally, in other words by calling
9896
`configureLogging`.
9997

100-
It is of course also possible to completely overwrite the default configuration, i.e. to customise the root logger and
98+
It is of course also possible to completely overwrite the default configuration, i.e. to customize the root logger and
10199
register a different appender than the `ConsoleAppender`.
102100

103101
#### Additional Appender
@@ -107,7 +105,8 @@ You can also register them on several loggers.
107105
If you use one of the logging methods of a logger, a LogEvent is created. This is bubbled up the hierarchy until an
108106
appender takes care of it. If this has happened, it is not passed up further.
109107

110-
You could add a hypothetical SQLiteAppender to the root logger this way:
108+
You could add a hypothetical SQLiteAppender (no longer hypothetical — see [`demo/sqlite`](tree/demo/sqlite))
109+
to the root logger this way:
111110

112111
```javascript
113112
configureLogging({
@@ -129,8 +128,8 @@ configureLogging({
129128

130129
#### Overwrite Formatting
131130

132-
Bit-Log is designed to be easy to use and extremely flexible. It is therefore possible to influence the formatting of
133-
the output for each appender.
131+
Bit-Log is designed to be straightforward to use and extremely flexible. It is therefore possible to influence the
132+
formatting of the output for each appender.
134133

135134
```typescript
136135
configureLogging({
@@ -183,7 +182,7 @@ As the name states, this appender writes to the console.
183182
It has three properties.
184183

185184
`colored: boolean`
186-
Specifies whether logs should be formatted with colors. By default, this property is set to `false`.
185+
Specifies whether logs should be formatted with colours. By default, this property is set to `false`.
187186

188187
`pretty: boolean`
189188
Specifies whether objects to be output should be formatted nicely, i.e. with indents and breaks.
@@ -197,20 +196,20 @@ By default, this property is set to `false`.
197196

198197
### `FileAppender`
199198

200-
This appender of course writes to a file and cannot be used in the browser environment.
199+
This appender, of course, writes to a file and cannot be used in the browser environment.
201200

202201
This implementation is *rolling*, as the name of the output file is calculated from the timestamp for each log event.
203202
This means that the appender switches to a new file after midnight.
204-
If you do not want this, you can simply overwrite the `getTimestamp` method as described above. You can also implement
205-
an hourly rolling output in the same way.
203+
If you do not want this, you can overwrite the `getTimestamp` method as described above. You can also implement an
204+
hourly rolling output in the same way.
206205

207206
The FileAppender has the following properties.
208207

209208
`baseName: string`
210209
Specifies a base name for the output file. By default, this property is set to an empty string.
211210

212211
The baseName can be empty as long as the `getTimestamp` method does not return an empty string.
213-
You can therefore combine both, or use both individually.
212+
You can therefore combine both or use both individually.
214213

215214
```text
216215
combined: MyLog-2024-05-13.log
@@ -219,7 +218,7 @@ timestamp only: 2024-05-13.log
219218
```
220219

221220
`colored: boolean`
222-
Specifies whether logs should be formatted with colors. By default, this property is set to `false`.
221+
Specifies whether logs should be formatted with colours. By default, this property is set to `false`.
223222

224223
`extension: string`
225224
Specifies the file extension. By default, this property is set to `log`.

package.json

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "@mburchard/bit-log",
33
"type": "module",
4-
"version": "0.8.1",
5-
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977",
4+
"version": "0.8.2",
5+
"packageManager": "pnpm@10.12.1+sha512.f0dda8580f0ee9481c5c79a1d927b9164f2c478e90992ad268bbb2465a736984391d6333d2c327913578b2804af33474ca554ba29c04a8b13060a717675ae3ac",
66
"description": "A Node library for logging",
77
"author": {
88
"name": "Martin Burchard",
@@ -23,6 +23,28 @@
2323
"rolling"
2424
],
2525
"main": "dist/index.js",
26+
"exports": {
27+
".": {
28+
"import": "./dist/index.js",
29+
"types": "./dist/index.d.ts"
30+
},
31+
"./ansi": {
32+
"import": "./dist/ansi.js",
33+
"types": "./dist/ansi.d.ts"
34+
},
35+
"./definitions": {
36+
"import": "./dist/definitions.js",
37+
"types": "./dist/definitions.d.ts"
38+
},
39+
"./logger": {
40+
"import": "./dist/logger.js",
41+
"types": "./dist/logger.d.ts"
42+
},
43+
"./utils": {
44+
"import": "./dist/utils.js",
45+
"types": "./dist/utils.d.ts"
46+
}
47+
},
2648
"files": [
2749
"dist"
2850
],
@@ -39,18 +61,18 @@
3961
"lint:fix": "eslint . --fix"
4062
},
4163
"devDependencies": {
42-
"@antfu/eslint-config": "^4.13.2",
64+
"@antfu/eslint-config": "^4.14.1",
4365
"@tsconfig/node20": "^20.1.5",
44-
"@types/node": "^22.15.21",
45-
"@vitest/coverage-v8": "^3.1.4",
46-
"@vitest/ui": "^3.1.4",
47-
"eslint": "^9.27.0",
48-
"glob": "^11.0.2",
66+
"@types/node": "^22.15.31",
67+
"@vitest/coverage-v8": "^3.2.3",
68+
"@vitest/ui": "^3.2.3",
69+
"eslint": "^9.28.0",
70+
"glob": "^11.0.3",
4971
"timezone-mock": "^1.3.6",
5072
"typescript": "~5.8.3",
5173
"vite": "^6.3.5",
5274
"vite-plugin-dts": "^4.5.4",
53-
"vitest": "^3.1.4"
75+
"vitest": "^3.2.3"
5476
},
5577
"pnpm": {
5678
"onlyBuiltDependencies": [

0 commit comments

Comments
 (0)