[Core] Clean up excess logs (#171143)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Christiane (Tina) Heiligers 2023-11-13 16:11:56 -07:00 committed by GitHub
parent af32b980a4
commit a37806a4f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 20 deletions

View file

@ -120,16 +120,6 @@ describe('UuidService', () => {
});
describe('process warnings', () => {
it('logs warnings coming from the process', async () => {
await service.preboot({ analytics });
const warning = new Error('something went wrong');
process.emit('warning', warning);
expect(logger.get('process').warn).toHaveBeenCalledTimes(1);
expect(logger.get('process').warn).toHaveBeenCalledWith(warning);
});
it('does not log deprecation warnings', async () => {
await service.preboot({ analytics });

View file

@ -46,13 +46,11 @@ export type InternalEnvironmentServiceSetup = InternalEnvironmentServicePreboot;
/** @internal */
export class EnvironmentService {
private readonly log: Logger;
private readonly processLogger: Logger;
private readonly configService: IConfigService;
private uuid: string = '';
constructor(core: CoreContext) {
this.log = core.logger.get('environment');
this.processLogger = core.logger.get('process');
this.configService = core.configService;
}
@ -71,14 +69,6 @@ export class EnvironmentService {
this.log.warn(`Detected an unhandled Promise rejection: ${message}`);
});
process.on('warning', (warning) => {
// deprecation warnings do no reflect a current problem for the user and should be filtered out.
if (warning.name === 'DeprecationWarning') {
return;
}
this.processLogger.warn(warning);
});
await createDataFolder({ pathConfig, logger: this.log });
await writePidFile({ pidConfig, logger: this.log });