@backstage/backend-defaults
Version:
Backend defaults used by Backstage backend apps
59 lines (55 loc) • 1.85 kB
TypeScript
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
import { RootLoggerService, LoggerService } from '@backstage/backend-plugin-api';
import { JsonObject } from '@backstage/types';
import { Format } from 'logform';
import { transport } from 'winston';
/**
* Root-level logging.
*
* See {@link @backstage/backend-plugin-api#RootLoggerService}
* and {@link https://backstage.io/docs/backend-system/core-services/root-logger | the service docs}
* for more information.
*
* @public
*/
declare const rootLoggerServiceFactory: _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.RootLoggerService, "root", "singleton">;
/**
* @public
*/
interface WinstonLoggerOptions {
meta?: JsonObject;
level?: string;
format?: Format;
transports?: transport[];
}
/**
* A {@link @backstage/backend-plugin-api#LoggerService} implementation based on winston.
*
* @public
*/
declare class WinstonLogger implements RootLoggerService {
#private;
/**
* Creates a {@link WinstonLogger} instance.
*/
static create(options: WinstonLoggerOptions): WinstonLogger;
/**
* Creates a winston log formatter for redacting secrets.
*/
static redacter(): {
format: Format;
add: (redactions: Iterable<string>) => void;
};
/**
* Creates a pretty printed winston log formatter.
*/
static colorFormat(): Format;
private constructor();
error(message: string, meta?: JsonObject): void;
warn(message: string, meta?: JsonObject): void;
info(message: string, meta?: JsonObject): void;
debug(message: string, meta?: JsonObject): void;
child(meta: JsonObject): LoggerService;
addRedactions(redactions: Iterable<string>): void;
}
export { WinstonLogger, type WinstonLoggerOptions, rootLoggerServiceFactory };