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 )
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
2727Logging is configured as follows by default:
2828
@@ -43,7 +43,7 @@ configureLogging({
4343#### The Call Site
4444
4545In 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.
4747Since this is a bit expensive, as the stack trace must be created, it is not activated by default.
4848To 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
8684const 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
9795the 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
10199register a different appender than the ` ConsoleAppender ` .
102100
103101#### Additional Appender
@@ -107,7 +105,8 @@ You can also register them on several loggers.
107105If you use one of the logging methods of a logger, a LogEvent is created. This is bubbled up the hierarchy until an
108106appender 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
113112configureLogging ({
@@ -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
136135configureLogging ({
@@ -183,7 +182,7 @@ As the name states, this appender writes to the console.
183182It 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 `
189188Specifies 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
202201This implementation is * rolling* , as the name of the output file is calculated from the timestamp for each log event.
203202This 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
207206The FileAppender has the following properties.
208207
209208` baseName: string `
210209Specifies a base name for the output file. By default, this property is set to an empty string.
211210
212211The 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
216215combined: 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 `
225224Specifies the file extension. By default, this property is set to ` log ` .
0 commit comments