Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ingest] Use Kibana logger for proper server-side logging #66017

Merged
merged 3 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions x-pack/plugins/ingest_manager/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { first } from 'rxjs/operators';
import {
CoreSetup,
CoreStart,
Logger,
Plugin,
PluginInitializerContext,
SavedObjectsServiceStart,
Expand Down Expand Up @@ -73,6 +74,7 @@ export interface IngestManagerAppContext {
isProductionMode: boolean;
kibanaVersion: string;
cloud?: CloudSetup;
logger?: Logger;
httpSetup?: HttpServiceSetup;
}

Expand Down Expand Up @@ -108,6 +110,7 @@ export class IngestManagerPlugin
private config$: Observable<IngestManagerConfigType>;
private security: SecurityPluginSetup | undefined;
private cloud: CloudSetup | undefined;
private logger: Logger | undefined;

private isProductionMode: boolean;
private kibanaVersion: string;
Expand All @@ -117,6 +120,7 @@ export class IngestManagerPlugin
this.config$ = this.initializerContext.config.create<IngestManagerConfigType>();
this.isProductionMode = this.initializerContext.env.mode.prod;
this.kibanaVersion = this.initializerContext.env.packageInfo.version;
this.logger = this.initializerContext.logger.get();
}

public async setup(core: CoreSetup, deps: IngestManagerSetupDeps) {
Expand Down Expand Up @@ -208,6 +212,7 @@ export class IngestManagerPlugin
kibanaVersion: this.kibanaVersion,
httpSetup: this.httpSetup,
cloud: this.cloud,
logger: this.logger,
});
licenseService.start(this.licensing$);
return {
Expand Down
8 changes: 7 additions & 1 deletion x-pack/plugins/ingest_manager/server/services/app_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import { BehaviorSubject, Observable } from 'rxjs';
import { first } from 'rxjs/operators';
import { SavedObjectsServiceStart, HttpServiceSetup } from 'src/core/server';
import { SavedObjectsServiceStart, HttpServiceSetup, Logger } from 'src/core/server';
import { EncryptedSavedObjectsPluginStart } from '../../../encrypted_saved_objects/server';
import { SecurityPluginSetup } from '../../../security/server';
import { IngestManagerConfigType } from '../../common';
Expand All @@ -21,6 +21,7 @@ class AppContextService {
private isProductionMode: boolean = false;
private kibanaVersion: string | undefined;
private cloud?: CloudSetup;
private logger?: Logger;
private httpSetup?: HttpServiceSetup;

public async start(appContext: IngestManagerAppContext) {
Expand All @@ -29,6 +30,7 @@ class AppContextService {
this.savedObjects = appContext.savedObjects;
this.isProductionMode = appContext.isProductionMode;
this.cloud = appContext.cloud;
this.logger = appContext.logger;
this.kibanaVersion = appContext.kibanaVersion;
this.httpSetup = appContext.httpSetup;

Expand Down Expand Up @@ -60,6 +62,10 @@ class AppContextService {
return this.cloud;
}

public getLogger() {
return this.logger;
}

public getConfig() {
return this.configSubject$?.value;
}
Expand Down