@koreanpanda/inscriber
Version:
A Logger that can write logs, and print them, with full customization.
136 lines (135 loc) • 5.56 kB
TypeScript
/**========================================================================
* ? ABOUT
* @author : Cody Spratford
* @email : koreanpanda345@gmail.com
* @repo : https://github.com/koreanpanda345/Inscriber
* @createdOn : 11/14/2020
* @description : This is the Config Builder. This Class can be used
* to make the config to be applied when creating the config file.
* @since : 11/21/2020
*========================================================================**/
/**=======================
* IMPORT
*========================**/
import { Config, CustomLogConfig } from "../global";
/**=======================
* END OF IMPORTS
*========================**/
/**==============================================
* InscriberConfigBuilder
* @classdesc This is to build the config
* to be used when making the config file.
*
*=============================================**/
export declare class InscriberConfigBuilder {
/**=======================
* CONSTANTS
*========================**/
private config;
/**=======================
* END OF CONSTANT
*========================**/
/**==============================================
* CONSTRUCTOR
*=============================================**/
constructor();
/**==============================================
* END OF CONSTRUCTOR
*=============================================**/
/**==============================================
* Time Pattern
* @summary Sets the time pattern that the log types should be using
* for <time> property in the logs.
* @param pattern The time pattern.
*=============================================**/
timePattern(pattern?: string): InscriberConfigBuilder;
/**==============================================
* One File
* @summary Sets the one file option in the config
* file. This will force all the log types to write
* logs to one file, for that day.
*
* @param on - Whether to be on or not. By Default
* its off.
*=============================================**/
oneFile(on?: boolean): InscriberConfigBuilder;
/**==============================================
* Write File
* @summary Sets the write file option in the config
* file. This will make Inscriber to write logs
* for each of the log types.
*
* @param on - Whether to be on or not. By Default
* its off.
*=============================================**/
writeFile(on?: boolean): InscriberConfigBuilder;
/**==============================================
* Log Patterns
* @summary Sets the log patterns option in the
* config. This will set what the log types will
* display when executed.
*
* @param patterns - The patterns for each of the log types.
*=============================================**/
logPatterns({ error, info, debug, warn, }: {
error?: string | undefined;
info?: string | undefined;
debug?: string | undefined;
warn?: string | undefined;
}): InscriberConfigBuilder;
/**==============================================
* Log Colors
* @summary Sets the log colors option in the
* config. This will change the colors of the log
* types, when being displayed on in the console.
*
* @param colors - The colors of the log types.
*=============================================**/
logColors({ error, info, debug, warn, }: {
error?: {
text: string;
background: string;
} | undefined;
info?: {
text: string;
background: string;
} | undefined;
debug?: {
text: string;
background: string;
} | undefined;
warn?: {
text: string;
background: string;
} | undefined;
}): InscriberConfigBuilder;
/**==============================================
* Log Paths
* @summary This will set the log paths option
* in the config file. This will direct all the
* log files for the certain log type to that
* location, unless the one file option is enabled,
* then it will direct it to the info type's path.
*
* @param paths - The paths of each of the log types.
*
*=============================================**/
logPaths({ error, info, debug, warn, }: {
error?: string | undefined;
info?: string | undefined;
debug?: string | undefined;
warn?: string | undefined;
}): InscriberConfigBuilder;
addCustomLog(logConfig: CustomLogConfig): InscriberConfigBuilder;
/**========================================================================
* Build
* @summary Builds the Config.
* @example <caption>How the builder works.</caption>
*
* ```js
* new InscriberConfigBuilder.logPaths({error: "./src/Logs/errors"}).build();
* ```
* @returns {Config} - the config that will be used when creating the file.
*========================================================================**/
build(): Config;
}