Skip to content

Commit

Permalink
Bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Dharandas committed Aug 17, 2021
1 parent 08dd115 commit 7353795
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion example/logger/src/example.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async function bootstrap() {
const app = await NestFactory.create(ExampleModule, {
logger,
});
app.useLogger(logger);
app.useLogger(createStackdriverLoggerTool(app as any));
const configService = app.get(ConfigService);
if (configService.get<string>('FORCE_REQUEST_TRACE') === 'true') {
app.use(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nestjs-pino-stackdriver",
"version": "2.1.1",
"version": "2.1.2",
"description": "NestJS Pino logger with Stackdriver support",
"author": "Jacob Dharandas Méndez <[email protected]>",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions src/tools/create-logger.tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export const createLoggerTool: (
config = configOrApp.get(LoggerConfig);
context = configOrApp.get(Context);
} else {
const config = new LoggerConfig(configOrApp);
config = new LoggerConfig(configOrApp);
context = new Context(
`System-Logger-${v4()}`,
config.context,
config?.context || {},
{} as RequestType,
);
}
Expand Down
13 changes: 7 additions & 6 deletions src/tools/create-stackdriver-logger.tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ export const createStackdriverLoggerTool = (
configOrApp: INestApplication | LoggerConfigType = {} as LoggerConfigType,
contextName?: string,
) => {
if (!isNestApplication(configOrApp)) {
return createLoggerTool(
createStackdriverLoggerConfig(configOrApp),
contextName,
);
if (isNestApplication(configOrApp)) {
return createLoggerTool(configOrApp, contextName);
}
return createLoggerTool(configOrApp, contextName);

return createLoggerTool(
createStackdriverLoggerConfig(configOrApp),
contextName,
);
};

0 comments on commit 7353795

Please sign in to comment.