@atomist/skill-logging
Version:
Atomist Skill Logging API
55 lines • 2 kB
TypeScript
/**
* Logging object suitable for submitting Skill logs.
*
* This implementation logs to Google Cloud Logging and will fall back
* to console logging in environments where Google Cloud Logging is not
* available.
*/
export interface Logger {
/**
* Log a message at debug level
* @param msg the message to log
* @param parameters additional optional parameters. Refer to util.format.
*/
debug(msg: string, ...parameters: any[]): void;
/**
* Log a message at info level
* @param msg the message to log
* @param parameters additional optional parameters. Refer to util.format.
*/
info(msg: string, ...parameters: any[]): void;
/**
* Log a message at warn level
* @param msg the message to log
* @param parameters additional optional parameters. Refer to util.format.
*/
warn(msg: string, ...parameters: any[]): void;
/**
* Log a message at error level
* @param msg the message to log
* @param parameters additional optional parameters. Refer to util.format.
*/
error(msg: string, ...parameters: any[]): void;
/**
* Close this Logger instance.
*
* Note: calling close is very important to avoid loosing log messages
* that are queued from any of the log methods above and processed asynchronously.
*/
close(): Promise<void>;
}
/**
* Create an instance of Logger from the current GCF context object
* @param context the context parameter passed into the GCF handler entry point
* @param labels additional labels to be added to the audit log
*/
export declare function createLogger(context: {
eventId?: string;
skillId: string;
correlationId: string;
workspaceId: string;
traceId?: string;
}, labels?: Record<string, any>, name?: string, project?: string): Logger;
export declare function chunk(s: string, maxBytes?: number): string[];
export declare function instanceId(): Promise<string>;
//# sourceMappingURL=logging.d.ts.map