@lexamica-modules/logger
Version:
The various loggers and transports used for API logging in the Lexamica Eco-system
70 lines (69 loc) • 3.95 kB
TypeScript
import winston from 'winston';
export interface ICreateLoggerEnvironmentOptions {
development?: {
slack_webhook?: string;
};
staging?: {
slack_webhook?: string;
};
}
interface ICreateLoggerOptions {
route?: ICreateLoggerEnvironmentOptions;
task?: ICreateLoggerEnvironmentOptions;
user?: ICreateLoggerEnvironmentOptions;
integration?: ICreateLoggerEnvironmentOptions;
auth?: ICreateLoggerEnvironmentOptions;
}
/**
* Logger initialization function
* @param datadog_key the API key to connect to datadog via transporter
* @param service a service string. Typically an API name or some other id
* @param environment the usage environment. Use the NODE_ENV env var
* @param slack_webhook give the webook url to transport these logs to a slack channel
* @returns {winston.Logger}
*/
export declare const authLogger: (datadog_key: string, service: string, environment: string, slack_webhook: string, defaultLevel: 'verbose' | 'info' | 'warn' | 'error', options?: ICreateLoggerEnvironmentOptions) => winston.Logger;
/**
* Logger initialization function
* @param datadog_key the API key to connect to datadog via transporter
* @param service a service string. Typically an API name or some other id
* @param environment the usage environment. Use the NODE_ENV env var
* @param slack_webhook give the webook url to transport these logs to a slack channel
* @returns {winston.Logger}
*/
export declare const taskLogger: (datadog_key: string, service: string, environment: string, slack_webhook: string, defaultLevel: 'verbose' | 'info' | 'warn' | 'error', options?: ICreateLoggerEnvironmentOptions) => winston.Logger;
/**
* Logger initialization function
* @param datadog_key the API key to connect to datadog via transporter
* @param service a service string. Typically an API name or some other id
* @param environment the usage environment. Use the NODE_ENV env var
* @param slack_webhook give the webook url to transport these logs to a slack channel
* @returns {winston.Logger}
*/
export declare const userLogger: (datadog_key: string, service: string, environment: string, slack_webhook: string, defaultLevel: 'verbose' | 'info' | 'warn' | 'error', options?: ICreateLoggerEnvironmentOptions) => winston.Logger;
/**
* Logger initialization function
* @param datadog_key the API key to connect to datadog via transporter
* @param service a service string. Typically an API name or some other id
* @param environment the usage environment. Use the NODE_ENV env var
* @param slack_webhook give the webook url to transport these logs to a slack channel
* @returns {winston.Logger}
*/
export declare const integrationLogger: (datadog_key: string, service: string, environment: string, slack_webhook: string, defaultLevel: 'verbose' | 'info' | 'warn' | 'error', options?: ICreateLoggerEnvironmentOptions) => winston.Logger;
/**
* Logger initialization function
* @param datadog_key the API key to connect to datadog via transporter
* @param service a service string. Typically an API name or some other id
* @param environment the usage environment. Use the NODE_ENV env var
* @returns {winston.Logger}
*/
export declare const routeLogger: (datadog_key: string, service: string, environment: string, defaultLevel: 'verbose' | 'info' | 'warn' | 'error', options?: ICreateLoggerEnvironmentOptions) => winston.Logger;
export declare class Loggers {
RouteLogger: winston.Logger;
TaskLogger: winston.Logger;
UserLogger: winston.Logger;
IntegrationLogger: winston.Logger;
AuthLogger: winston.Logger;
constructor(datadog_api_key: string, service: string, environment: 'development' | 'staging' | 'demo' | 'production', slack_user_logs_webhook: string, slack_task_logs_webhook: string, slack_auth_logs_webhook: string, slack_integration_logs_webhook: string, defaultLevel?: 'verbose' | 'info' | 'warn' | 'error', options?: ICreateLoggerOptions);
}
export {};