Skip to content

Commit d2788b3

Browse files
Merge pull request #1832 from Tony133/chore/improvements
chore(): improvements
2 parents 1aa4a0d + 318be4a commit d2788b3

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

content/graphql/scalars.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ import GraphQLJSON from 'graphql-type-json';
9898
}),
9999
],
100100
})
101-
export class ApplicationModule {}
101+
export class AppModule {}
102102
```
103103

104104
Now we can use the `JSON` scalar in our type definitions:

content/techniques/logger.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For more advanced logging functionality, you can make use of any Node.js logging
1818
To disable logging, set the `logger` property to `false` in the (optional) Nest application options object passed as the second argument to the `NestFactory.create()` method.
1919

2020
```typescript
21-
const app = await NestFactory.create(ApplicationModule, {
21+
const app = await NestFactory.create(AppModule, {
2222
logger: false,
2323
});
2424
await app.listen(3000);
@@ -27,7 +27,7 @@ await app.listen(3000);
2727
To enable specific logging levels, set the `logger` property to an array of strings specifying the log levels to display, as follows:
2828

2929
```typescript
30-
const app = await NestFactory.create(ApplicationModule, {
30+
const app = await NestFactory.create(AppModule, {
3131
logger: ['error', 'warn'],
3232
});
3333
await app.listen(3000);
@@ -42,7 +42,7 @@ Values in the array can be any combination of `'log'`, `'error'`, `'warn'`, `'de
4242
You can provide a custom logger implementation to be used by Nest for system logging by setting the value of the `logger` property to an object that fulfills the `LoggerService` interface. For example, you can tell Nest to use the built-in global JavaScript `console` object (which implements the `LoggerService` interface), as follows:
4343

4444
```typescript
45-
const app = await NestFactory.create(ApplicationModule, {
45+
const app = await NestFactory.create(AppModule, {
4646
logger: console,
4747
});
4848
await app.listen(3000);
@@ -75,7 +75,7 @@ export class MyLogger implements LoggerService {
7575
You can then supply an instance of `MyLogger` via the `logger` property of the Nest application options object.
7676

7777
```typescript
78-
const app = await NestFactory.create(ApplicationModule, {
78+
const app = await NestFactory.create(AppModule, {
7979
logger: new MyLogger(),
8080
});
8181
await app.listen(3000);
@@ -127,7 +127,7 @@ With this construct, you are now providing your custom logger for use by any oth
127127
Because application instantiation (`NestFactory.create()`) happens outside the context of any module, it doesn't participate in the normal Dependency Injection phase of initialization. So we must ensure that at least one application module imports the `LoggerModule` to trigger Nest to instantiate a singleton instance of our `MyLogger` class. We can then instruct Nest to use the same singleton instance of `MyLogger` with the following construction:
128128

129129
```typescript
130-
const app = await NestFactory.create(ApplicationModule, {
130+
const app = await NestFactory.create(AppModule, {
131131
logger: false,
132132
});
133133
app.useLogger(app.get(MyLogger));
@@ -140,7 +140,7 @@ The only downside of this solution is that your first initialization messages wo
140140
Alternatively you can print first initialization messages using default logger, and then switch to your custom one:
141141

142142
```typescript
143-
const app = await NestFactory.create(ApplicationModule);
143+
const app = await NestFactory.create(AppModule);
144144
app.useLogger(app.get(MyLogger));
145145
await app.listen(3000);
146146
```
@@ -235,7 +235,7 @@ export class CatsService {
235235
Finally, instruct Nest to use an instance of the custom logger in your `main.ts` file as shown below. Of course in this example, we haven't actually customized the logger behavior (by extending the `Logger` methods like `log()`, `warn()`, etc.), so this step isn't actually needed. But it **would** be needed if you added custom logic to those methods and wanted Nest to use the same implementation.
236236

237237
```typescript
238-
const app = await NestFactory.create(ApplicationModule, {
238+
const app = await NestFactory.create(AppModule, {
239239
logger: false,
240240
});
241241
app.useLogger(new MyLogger());

0 commit comments

Comments
 (0)