You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -144,7 +146,7 @@ This feature enables `tslog` to reference a correct line number in your TypeScri
144
146
```typescript
145
147
import { Logger } from"tslog";
146
148
147
-
const logger =newLogger();
149
+
const logger =newLogger({ name: "myLogger" });
148
150
logger.silly("I am a silly log.");
149
151
logger.trace("I am a trace log.");
150
152
logger.debug("I am a debug log.");
@@ -169,6 +171,8 @@ logger.fatal(new Error("I am a pretty Error with a stacktrace."));
169
171
-**Pretty Error:** Errors and stack traces printed in a structured way and fully accessible through _JSON_ (e.g. external Log services)
170
172
-**ES Modules:** import syntax with ([tree-shaking](https://webpack.js.org/guides/tree-shaking/))
171
173
-**Object/JSON highlighting:** Nicely prints out objects
174
+
-**Instance Name**: _(Server-side only)_ Logs capture instance name (default host name) making it easy to distinguish logs coming from different instances
175
+
-**Named Logger:** Logger can be named (e.g. useful for packages/modules and monorepos)
172
176
-**Sub Logger with inheritance:** Powerful sub-loggers with settings inheritance, also at runtime
173
177
-**Secrets masking:** Prevent passwords and secrets from sneaking into log files by masking them
174
178
-**Short paths:** Paths are relative to the root of the application folder
@@ -268,6 +272,36 @@ const jsonLogger = new Logger({type: "json"});
268
272
const hiddenLogger =newLogger({type: "hidden"});
269
273
```
270
274
275
+
276
+
#### Name
277
+
278
+
Each logger has an optional name. You can find the name of the logger responsible for a log inside the `Meta`-object or printed in `pretty` mode.
279
+
Names get also inherited to sub loggers and can be found inside the `Meta`-object `parentNames` as well as printed out with a separator (e.g. `:`).
0 commit comments