UNPKG

log4js2

Version:

[![Build Status](https://travis-ci.org/anigenero/log4js2.svg?branch=master)](https://travis-ci.org/anigenero/log4js2) [![codecov](https://codecov.io/gh/anigenero/log4js2/branch/master/graph/badge.svg)](https://codecov.io/gh/anigenero/log4js2)

219 lines (218 loc) 4.62 kB
import { ILogEvent } from '../log.event'; export declare class Formatter { /** * @function * @memberOf formatter * * @param {string} layout * * @return {string} */ static preCompile(layout: string): void; /** * @function * @memberOf formatter * * @param {string} layout * @param {ILogEvent} logEvent * * @return {string} */ static format(layout: string, logEvent: ILogEvent): string; private static readonly _formatters; /** @type {Map} */ private static _compiledLayouts; /** * @function * @memberOf formatter * * @param {ILogEvent} logEvent * * @return {string} */ private static _formatLogger; /** * @function * @memberOf formatter * * @param {ILogEvent} logEvent * @param {Array.<string>} params * * @return {string} */ private static _formatDate; /** * @function * @memberOf formatter * * @param {ILogEvent} logEvent * * @return {string} */ private static _formatException; /** * Formats the file (e.g. test.js) to the file * * @private * @function * @memberOf formatter * * @param {ILogEvent} logEvent */ private static _formatFile; /** * @function * @memberOf formatter * * @param {ILogEvent} logEvent * * @return {string} */ private static _formatLineNumber; /** * @function * @memberOf formatter * * @param {ILogEvent} logEvent * * @return {string} */ private static _formatColumn; /** * @function * @memberOf formatter * * @param {ILogEvent} logEvent * @param {Array.<string>} params * * @return {string} */ private static _formatMapMessage; /** * @function * @memberOf formatter * * @param {ILogEvent} logEvent * * @return {string} */ private static _formatLogMessage; /** * @function * @memberOf formatter * * @param {ILogEvent} logEvent * * @return {string} */ private static _formatMethodName; /** * @private * @function * @memberOf formatter */ private static _formatLineSeparator; /** * @function * @memberOf formatter * * @param {ILogEvent} logEvent * * @return {string} */ private static _formatLevel; /** * @function * @memberOf formatter * * @param {ILogEvent} logEvent * * @return {string} */ private static _formatRelative; /** * @function * @memberOf formatter * * @param {ILogEvent} logEvent * * @return {string} */ private static _formatSequenceNumber; /** * Get the compiled layout for the specified layout string. If the compiled layout does not * exist, then we want to create it. * * @function * @memberOf formatter * * @param {string} layout * * @return {Array.<string|function>} */ private static _getCompiledLayout; /** * Compiles a layout into an array. The array contains functions * * @function * @memberOf formatter * * @param {string} layout * * @return {Array.<string|function>} */ private static _compileLayout; /** * @function * @memberOf formatter * * @param {string} formatString * * @return {Object|string} */ private static _getFormatterObject; /** * Determines what formatter function has been configured * * @function * @memberOf formatter * * @param {string} command * * @return {?string} */ private static _getFormatterFunction; /** * Gets the layout tag params associated with the layout tag. So, for example, '%d{yyyy-MM-dd}` * would output an array of ['yyyy-MM-dd'] * * @private * @function * * @param {string} command * * @return {Array.<string>} */ private static _getLayoutTagParams; /** * Handles formatting the log event using the specified formatter array * * @private * @function * * @param {Array.<function|string>} formatter * @param {ILogEvent} logEvent * * @return {string} */ private static _formatLogEvent; /** * * @private * @function * @memberOf formatter * * @param {ILogEvent} logEvent */ private static _getFileDetails; }