googleapis / googleapis/google-cloud-node
Logging a circularly dependent object does nothing.
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
#### Environment details
- OS: Mac OS 15
- Node.js version: 22
- npm version: 10.8.3
- `@google-cloud/logging` version: 11.2 (via logging-winston 6.0.0)
#### Steps to reproduce
1. log something having a circular reference
2. see nothing in the logs
The below will using a plain console transport log an error.
With the LoggingWinston transport on the other hand the error will be silent.
```
import { LoggingWinston } from "@google-cloud/logging-winston";
import winston from 'winston';
const logSomething = (transport) => {
const logger = winston.createLogger({
transports: [transport],
format: winston.format.combine(
winston.format.errors({ stack: true }),
winston.format.json()),
})
logger.info('hello logging world');
const error = {
message: 'hello error world',
};
//it's usally indirect but this will do
error['cause'] = error;
logger.error('here a circular problem', error);
logger.info('bye');
}
logSomething(new winston.transports.Console());
logSomething(new LoggingWinston({
redirectToStdout: true,
useMessageField: false,
projectId: process.env.gcpProjectId,
}));
```
This is extra problematic due to a common error AxiosError having a circular dependency and hence such failures are omitted from production logs.
Contributor guide
Assessment
This issue has not been assessed yet.