UNPKG

ionic-logging-service

Version:

Logging functionalities for apps built with Ionic framework

89 lines (88 loc) 2.85 kB
import * as log4javascript from "log4javascript"; import { LogLevel } from "./log-level.model"; /** * Logger for writing log messages. */ export declare class Logger { private logger; /** * Creates a new instance of a logger. */ constructor(logger?: string | any); /** * Get the log level. */ getLogLevel(): LogLevel; /** * Set the log level. * * @param level the new log level */ setLogLevel(level: LogLevel): void; /** * Logs a message at level TRACE. * * @param methodName name of the method * @param params optional parameters to be logged; objects will be formatted as JSON */ trace(methodName: string, ...params: any[]): void; /** * Logs a message at level DEBUG. * * @param methodName name of the method * @param params optional parameters to be logged; objects will be formatted as JSON */ debug(methodName: string, ...params: any[]): void; /** * Logs a message at level INFO. * * @param methodName name of the method * @param params optional parameters to be logged; objects will be formatted as JSON */ info(methodName: string, ...params: any[]): void; /** * Logs a message at level WARN. * * @param methodName name of the method * @param params optional parameters to be logged; objects will be formatted as JSON */ warn(methodName: string, ...params: any[]): void; /** * Logs a message at level ERROR. * * @param methodName name of the method * @param params optional parameters to be logged; objects will be formatted as JSON */ error(methodName: string, ...params: any[]): void; /** * Logs a message at level FATAL. * * @param methodName name of the method * @param params optional parameters to be logged; objects will be formatted as JSON */ fatal(methodName: string, ...params: any[]): void; /** * Logs the entry into a method. * The method name will be logged at level INFO, the parameters at level DEBUG. * * @param methodName name of the method * @param params optional parameters to be logged; objects will be formatted as JSON */ entry(methodName: string, ...params: any[]): void; /** * Logs the exit of a method. * The method name will be logged at level INFO, the parameters at level DEBUG. * * @param methodName name of the method * @param params optional parameters to be logged; objects will be formatted as JSON */ exit(methodName: string, ...params: any[]): void; /** * Formats the given argument. */ formatArgument(arg: any): string; /** * Returns the internal Logger (for unit tests only). */ getInternalLogger(): log4javascript.Logger; }