@breadstone-infrastructure/utilities 0.0.12-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cli/Abstracts/ProgramCommandBase.d.ts +60 -0
- package/Cli/Abstracts/ProgramCommandBase.d.ts.map +1 -0
- package/Cli/Abstracts/ProgramCommandBase.js +64 -0
- package/Cli/Abstracts/ProgramCommandBase.js.map +1 -0
- package/Cli/Builders/ProgramBuilder.d.ts +39 -0
- package/Cli/Builders/ProgramBuilder.d.ts.map +1 -0
- package/Cli/Builders/ProgramBuilder.js +73 -0
- package/Cli/Builders/ProgramBuilder.js.map +1 -0
- package/Cli/Builders/ProgramCommandBuilder.d.ts +78 -0
- package/Cli/Builders/ProgramCommandBuilder.d.ts.map +1 -0
- package/Cli/Builders/ProgramCommandBuilder.js +147 -0
- package/Cli/Builders/ProgramCommandBuilder.js.map +1 -0
- package/Cli/Interfaces/IProgramArg.d.ts +11 -0
- package/Cli/Interfaces/IProgramArg.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramArg.js +4 -0
- package/Cli/Interfaces/IProgramArg.js.map +1 -0
- package/Cli/Interfaces/IProgramArgOptions.d.ts +9 -0
- package/Cli/Interfaces/IProgramArgOptions.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramArgOptions.js +4 -0
- package/Cli/Interfaces/IProgramArgOptions.js.map +1 -0
- package/Cli/Interfaces/IProgramArgs.d.ts +27 -0
- package/Cli/Interfaces/IProgramArgs.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramArgs.js +4 -0
- package/Cli/Interfaces/IProgramArgs.js.map +1 -0
- package/Cli/Interfaces/IProgramCommand.d.ts +53 -0
- package/Cli/Interfaces/IProgramCommand.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramCommand.js +4 -0
- package/Cli/Interfaces/IProgramCommand.js.map +1 -0
- package/Cli/Interfaces/IProgramCommands.d.ts +47 -0
- package/Cli/Interfaces/IProgramCommands.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramCommands.js +4 -0
- package/Cli/Interfaces/IProgramCommands.js.map +1 -0
- package/Cli/Interfaces/IProgramConfig.d.ts +10 -0
- package/Cli/Interfaces/IProgramConfig.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramConfig.js +3 -0
- package/Cli/Interfaces/IProgramConfig.js.map +1 -0
- package/Cli/Interfaces/IProgramInit.d.ts +14 -0
- package/Cli/Interfaces/IProgramInit.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramInit.js +3 -0
- package/Cli/Interfaces/IProgramInit.js.map +1 -0
- package/Cli/Program.d.ts +97 -0
- package/Cli/Program.d.ts.map +1 -0
- package/Cli/Program.js +217 -0
- package/Cli/Program.js.map +1 -0
- package/Cli/ProgramArgs.d.ts +39 -0
- package/Cli/ProgramArgs.d.ts.map +1 -0
- package/Cli/ProgramArgs.js +83 -0
- package/Cli/ProgramArgs.js.map +1 -0
- package/Cli/ProgramCommandResult.d.ts +13 -0
- package/Cli/ProgramCommandResult.d.ts.map +1 -0
- package/Cli/ProgramCommandResult.js +3 -0
- package/Cli/ProgramCommandResult.js.map +1 -0
- package/Cli/ProgramCommands.d.ts +66 -0
- package/Cli/ProgramCommands.d.ts.map +1 -0
- package/Cli/ProgramCommands.js +173 -0
- package/Cli/ProgramCommands.js.map +1 -0
- package/Cli/ProgramConfig.d.ts +24 -0
- package/Cli/ProgramConfig.d.ts.map +1 -0
- package/Cli/ProgramConfig.js +51 -0
- package/Cli/ProgramConfig.js.map +1 -0
- package/Cli/ProgramDoneFn.d.ts +5 -0
- package/Cli/ProgramDoneFn.d.ts.map +1 -0
- package/Cli/ProgramDoneFn.js +3 -0
- package/Cli/ProgramDoneFn.js.map +1 -0
- package/Compiler/TypeScript.d.ts +19 -0
- package/Compiler/TypeScript.d.ts.map +1 -0
- package/Compiler/TypeScript.js +166 -0
- package/Compiler/TypeScript.js.map +1 -0
- package/DI/Container.d.ts +73 -0
- package/DI/Container.d.ts.map +1 -0
- package/DI/Container.js +143 -0
- package/DI/Container.js.map +1 -0
- package/DI/Inject.d.ts +11 -0
- package/DI/Inject.d.ts.map +1 -0
- package/DI/Inject.js +18 -0
- package/DI/Inject.js.map +1 -0
- package/Decorators/EnumerableDecorator.d.ts +6 -0
- package/Decorators/EnumerableDecorator.d.ts.map +1 -0
- package/Decorators/EnumerableDecorator.js +18 -0
- package/Decorators/EnumerableDecorator.js.map +1 -0
- package/Events/AsyncEventEmitter.d.ts +8 -0
- package/Events/AsyncEventEmitter.d.ts.map +1 -0
- package/Events/AsyncEventEmitter.js +37 -0
- package/Events/AsyncEventEmitter.js.map +1 -0
- package/IO/CustomElementManifest.d.ts +254 -0
- package/IO/CustomElementManifest.d.ts.map +1 -0
- package/IO/CustomElementManifest.js +56 -0
- package/IO/CustomElementManifest.js.map +1 -0
- package/IO/Directory.d.ts +78 -0
- package/IO/Directory.d.ts.map +1 -0
- package/IO/Directory.js +184 -0
- package/IO/Directory.js.map +1 -0
- package/IO/Encoding.d.ts +2 -0
- package/IO/Encoding.d.ts.map +1 -0
- package/IO/Encoding.js +3 -0
- package/IO/Encoding.js.map +1 -0
- package/IO/File.d.ts +148 -0
- package/IO/File.d.ts.map +1 -0
- package/IO/File.js +314 -0
- package/IO/File.js.map +1 -0
- package/IO/FileSystemInfo.d.ts +46 -0
- package/IO/FileSystemInfo.d.ts.map +1 -0
- package/IO/FileSystemInfo.js +129 -0
- package/IO/FileSystemInfo.js.map +1 -0
- package/IO/FileSystemWatcher.d.ts +49 -0
- package/IO/FileSystemWatcher.d.ts.map +1 -0
- package/IO/FileSystemWatcher.js +93 -0
- package/IO/FileSystemWatcher.js.map +1 -0
- package/IO/Glob.d.ts +35 -0
- package/IO/Glob.d.ts.map +1 -0
- package/IO/Glob.js +152 -0
- package/IO/Glob.js.map +1 -0
- package/IO/Json.d.ts +84 -0
- package/IO/Json.d.ts.map +1 -0
- package/IO/Json.js +114 -0
- package/IO/Json.js.map +1 -0
- package/IO/Path.d.ts +125 -0
- package/IO/Path.d.ts.map +1 -0
- package/IO/Path.js +283 -0
- package/IO/Path.js.map +1 -0
- package/IO/PcfControlManifest.d.ts +79 -0
- package/IO/PcfControlManifest.d.ts.map +1 -0
- package/IO/PcfControlManifest.js +93 -0
- package/IO/PcfControlManifest.js.map +1 -0
- package/IO/Reader/Interfaces/IFileReader.d.ts +30 -0
- package/IO/Reader/Interfaces/IFileReader.d.ts.map +1 -0
- package/IO/Reader/Interfaces/IFileReader.js +3 -0
- package/IO/Reader/Interfaces/IFileReader.js.map +1 -0
- package/IO/Reader/TextFileReader.d.ts +53 -0
- package/IO/Reader/TextFileReader.d.ts.map +1 -0
- package/IO/Reader/TextFileReader.js +167 -0
- package/IO/Reader/TextFileReader.js.map +1 -0
- package/IO/Resx.d.ts +49 -0
- package/IO/Resx.d.ts.map +1 -0
- package/IO/Resx.js +95 -0
- package/IO/Resx.js.map +1 -0
- package/IO/SymbolikLink.d.ts +6 -0
- package/IO/SymbolikLink.d.ts.map +1 -0
- package/IO/SymbolikLink.js +10 -0
- package/IO/SymbolikLink.js.map +1 -0
- package/IO/Template.d.ts +41 -0
- package/IO/Template.d.ts.map +1 -0
- package/IO/Template.js +71 -0
- package/IO/Template.js.map +1 -0
- package/IO/TemporaryDirectory.d.ts +28 -0
- package/IO/TemporaryDirectory.d.ts.map +1 -0
- package/IO/TemporaryDirectory.js +76 -0
- package/IO/TemporaryDirectory.js.map +1 -0
- package/IO/TemporaryFile.d.ts +28 -0
- package/IO/TemporaryFile.d.ts.map +1 -0
- package/IO/TemporaryFile.js +77 -0
- package/IO/TemporaryFile.js.map +1 -0
- package/IO/Writer/Interfaces/IFileWriter.d.ts +31 -0
- package/IO/Writer/Interfaces/IFileWriter.d.ts.map +1 -0
- package/IO/Writer/Interfaces/IFileWriter.js +4 -0
- package/IO/Writer/Interfaces/IFileWriter.js.map +1 -0
- package/IO/Writer/TextFileWriter.d.ts +56 -0
- package/IO/Writer/TextFileWriter.d.ts.map +1 -0
- package/IO/Writer/TextFileWriter.js +129 -0
- package/IO/Writer/TextFileWriter.js.map +1 -0
- package/IO/vNext/FileCache.d.ts +46 -0
- package/IO/vNext/FileCache.d.ts.map +1 -0
- package/IO/vNext/FileCache.js +94 -0
- package/IO/vNext/FileCache.js.map +1 -0
- package/IO/vNext/FileSystem.d.ts +107 -0
- package/IO/vNext/FileSystem.d.ts.map +1 -0
- package/IO/vNext/FileSystem.js +148 -0
- package/IO/vNext/FileSystem.js.map +1 -0
- package/IO/vNext/Interfaces/IFileCache.d.ts +56 -0
- package/IO/vNext/Interfaces/IFileCache.d.ts.map +1 -0
- package/IO/vNext/Interfaces/IFileCache.js +3 -0
- package/IO/vNext/Interfaces/IFileCache.js.map +1 -0
- package/IO/vNext/Interfaces/IFileSystem.d.ts +102 -0
- package/IO/vNext/Interfaces/IFileSystem.d.ts.map +1 -0
- package/IO/vNext/Interfaces/IFileSystem.js +4 -0
- package/IO/vNext/Interfaces/IFileSystem.js.map +1 -0
- package/Index.d.ts +62 -0
- package/Index.d.ts.map +1 -0
- package/Index.js +132 -0
- package/Index.js.map +1 -0
- package/Intl/Languages.d.ts +12 -0
- package/Intl/Languages.d.ts.map +1 -0
- package/Intl/Languages.js +865 -0
- package/Intl/Languages.js.map +1 -0
- package/LICENSE +21 -0
- package/Logging/Appenders/Abstracts/Appender.d.ts +21 -0
- package/Logging/Appenders/Abstracts/Appender.d.ts.map +1 -0
- package/Logging/Appenders/Abstracts/Appender.js +78 -0
- package/Logging/Appenders/Abstracts/Appender.js.map +1 -0
- package/Logging/Appenders/Interfaces/IAppender.d.ts +13 -0
- package/Logging/Appenders/Interfaces/IAppender.d.ts.map +1 -0
- package/Logging/Appenders/Interfaces/IAppender.js +4 -0
- package/Logging/Appenders/Interfaces/IAppender.js.map +1 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.d.ts +9 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.d.ts.map +1 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.js +3 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.js.map +1 -0
- package/Logging/Appenders/LogLevelAppender.d.ts +29 -0
- package/Logging/Appenders/LogLevelAppender.d.ts.map +1 -0
- package/Logging/Appenders/LogLevelAppender.js +102 -0
- package/Logging/Appenders/LogLevelAppender.js.map +1 -0
- package/Logging/Appenders/MessageAppender.d.ts +26 -0
- package/Logging/Appenders/MessageAppender.d.ts.map +1 -0
- package/Logging/Appenders/MessageAppender.js +91 -0
- package/Logging/Appenders/MessageAppender.js.map +1 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.d.ts +20 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.d.ts.map +1 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.js +4 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.js.map +1 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.d.ts +5 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.d.ts.map +1 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.js +3 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.js.map +1 -0
- package/Logging/Appenders/TagAppender.d.ts +25 -0
- package/Logging/Appenders/TagAppender.d.ts.map +1 -0
- package/Logging/Appenders/TagAppender.js +49 -0
- package/Logging/Appenders/TagAppender.js.map +1 -0
- package/Logging/Appenders/TimeStampAppender.d.ts +22 -0
- package/Logging/Appenders/TimeStampAppender.d.ts.map +1 -0
- package/Logging/Appenders/TimeStampAppender.js +44 -0
- package/Logging/Appenders/TimeStampAppender.js.map +1 -0
- package/Logging/Interfaces/ILogEntry.d.ts +13 -0
- package/Logging/Interfaces/ILogEntry.d.ts.map +1 -0
- package/Logging/Interfaces/ILogEntry.js +4 -0
- package/Logging/Interfaces/ILogEntry.js.map +1 -0
- package/Logging/Interfaces/ILogOptions.d.ts +17 -0
- package/Logging/Interfaces/ILogOptions.d.ts.map +1 -0
- package/Logging/Interfaces/ILogOptions.js +4 -0
- package/Logging/Interfaces/ILogOptions.js.map +1 -0
- package/Logging/Interfaces/ILoggerScope.d.ts +7 -0
- package/Logging/Interfaces/ILoggerScope.d.ts.map +1 -0
- package/Logging/Interfaces/ILoggerScope.js +3 -0
- package/Logging/Interfaces/ILoggerScope.js.map +1 -0
- package/Logging/Interfaces/ILoggerScopeConfig.d.ts +9 -0
- package/Logging/Interfaces/ILoggerScopeConfig.d.ts.map +1 -0
- package/Logging/Interfaces/ILoggerScopeConfig.js +4 -0
- package/Logging/Interfaces/ILoggerScopeConfig.js.map +1 -0
- package/Logging/LogLevel.d.ts +5 -0
- package/Logging/LogLevel.d.ts.map +1 -0
- package/Logging/LogLevel.js +3 -0
- package/Logging/LogLevel.js.map +1 -0
- package/Logging/Logger.d.ts +148 -0
- package/Logging/Logger.d.ts.map +1 -0
- package/Logging/Logger.js +326 -0
- package/Logging/Logger.js.map +1 -0
- package/Logging/LoggerConfig.d.ts +45 -0
- package/Logging/LoggerConfig.d.ts.map +1 -0
- package/Logging/LoggerConfig.js +83 -0
- package/Logging/LoggerConfig.js.map +1 -0
- package/Logging/LoggerScope.d.ts +16 -0
- package/Logging/LoggerScope.d.ts.map +1 -0
- package/Logging/LoggerScope.js +81 -0
- package/Logging/LoggerScope.js.map +1 -0
- package/Logging/LoggerSuppressor.d.ts +10 -0
- package/Logging/LoggerSuppressor.d.ts.map +1 -0
- package/Logging/LoggerSuppressor.js +43 -0
- package/Logging/LoggerSuppressor.js.map +1 -0
- package/Logging/LoggerUtils.d.ts +47 -0
- package/Logging/LoggerUtils.d.ts.map +1 -0
- package/Logging/LoggerUtils.js +102 -0
- package/Logging/LoggerUtils.js.map +1 -0
- package/Logging/vNext/ConsoleLogger.d.ts +56 -0
- package/Logging/vNext/ConsoleLogger.d.ts.map +1 -0
- package/Logging/vNext/ConsoleLogger.js +76 -0
- package/Logging/vNext/ConsoleLogger.js.map +1 -0
- package/Logging/vNext/Interfaces/ILogger.d.ts +38 -0
- package/Logging/vNext/Interfaces/ILogger.d.ts.map +1 -0
- package/Logging/vNext/Interfaces/ILogger.js +3 -0
- package/Logging/vNext/Interfaces/ILogger.js.map +1 -0
- package/Logging/vNext/LoggerExtensions.d.ts +79 -0
- package/Logging/vNext/LoggerExtensions.d.ts.map +1 -0
- package/Logging/vNext/LoggerExtensions.js +175 -0
- package/Logging/vNext/LoggerExtensions.js.map +1 -0
- package/Logging/vNext/Styles/Style.d.ts +9 -0
- package/Logging/vNext/Styles/Style.d.ts.map +1 -0
- package/Logging/vNext/Styles/Style.js +17 -0
- package/Logging/vNext/Styles/Style.js.map +1 -0
- package/Logging/vNext/Styles/StyleDirectives.d.ts +61 -0
- package/Logging/vNext/Styles/StyleDirectives.d.ts.map +1 -0
- package/Logging/vNext/Styles/StyleDirectives.js +118 -0
- package/Logging/vNext/Styles/StyleDirectives.js.map +1 -0
- package/System/Args.d.ts +20 -0
- package/System/Args.d.ts.map +1 -0
- package/System/Args.js +45 -0
- package/System/Args.js.map +1 -0
- package/System/Array.d.ts +41 -0
- package/System/Array.d.ts.map +1 -0
- package/System/Array.js +91 -0
- package/System/Array.js.map +1 -0
- package/System/Assign.d.ts +12 -0
- package/System/Assign.d.ts.map +1 -0
- package/System/Assign.js +40 -0
- package/System/Assign.js.map +1 -0
- package/System/Boolean.d.ts +20 -0
- package/System/Boolean.d.ts.map +1 -0
- package/System/Boolean.js +52 -0
- package/System/Boolean.js.map +1 -0
- package/System/Error.d.ts +9 -0
- package/System/Error.d.ts.map +1 -0
- package/System/Error.js +20 -0
- package/System/Error.js.map +1 -0
- package/System/Errors.d.ts +7 -0
- package/System/Errors.d.ts.map +1 -0
- package/System/Errors.js +18 -0
- package/System/Errors.js.map +1 -0
- package/System/Formatter.d.ts +4 -0
- package/System/Formatter.d.ts.map +1 -0
- package/System/Formatter.js +17 -0
- package/System/Formatter.js.map +1 -0
- package/System/Guard.d.ts +5 -0
- package/System/Guard.d.ts.map +1 -0
- package/System/Guard.js +29 -0
- package/System/Guard.js.map +1 -0
- package/System/Interfaces/IType.d.ts +7 -0
- package/System/Interfaces/IType.d.ts.map +1 -0
- package/System/Interfaces/IType.js +3 -0
- package/System/Interfaces/IType.js.map +1 -0
- package/System/Interfaces/IUnknown.d.ts +7 -0
- package/System/Interfaces/IUnknown.d.ts.map +1 -0
- package/System/Interfaces/IUnknown.js +3 -0
- package/System/Interfaces/IUnknown.js.map +1 -0
- package/System/List.d.ts +27 -0
- package/System/List.d.ts.map +1 -0
- package/System/List.js +84 -0
- package/System/List.js.map +1 -0
- package/System/Number.d.ts +10 -0
- package/System/Number.d.ts.map +1 -0
- package/System/Number.js +28 -0
- package/System/Number.js.map +1 -0
- package/System/Process.d.ts +30 -0
- package/System/Process.d.ts.map +1 -0
- package/System/Process.js +167 -0
- package/System/Process.js.map +1 -0
- package/System/Require.d.ts +8 -0
- package/System/Require.d.ts.map +1 -0
- package/System/Require.js +20 -0
- package/System/Require.js.map +1 -0
- package/System/Stopwatch.d.ts +19 -0
- package/System/Stopwatch.d.ts.map +1 -0
- package/System/Stopwatch.js +73 -0
- package/System/Stopwatch.js.map +1 -0
- package/System/String.d.ts +19 -0
- package/System/String.d.ts.map +1 -0
- package/System/String.js +177 -0
- package/System/String.js.map +1 -0
- package/System/Time.d.ts +7 -0
- package/System/Time.d.ts.map +1 -0
- package/System/Time.js +16 -0
- package/System/Time.js.map +1 -0
- package/System/Version.d.ts +20 -0
- package/System/Version.d.ts.map +1 -0
- package/System/Version.js +135 -0
- package/System/Version.js.map +1 -0
- package/Terminal/Terminal.d.ts +7 -0
- package/Terminal/Terminal.d.ts.map +1 -0
- package/Terminal/Terminal.js +21 -0
- package/Terminal/Terminal.js.map +1 -0
- package/Terminal/TerminalColorType.d.ts +2 -0
- package/Terminal/TerminalColorType.d.ts.map +1 -0
- package/Terminal/TerminalColorType.js +3 -0
- package/Terminal/TerminalColorType.js.map +1 -0
- package/Terminal/TerminalColors.d.ts +38 -0
- package/Terminal/TerminalColors.d.ts.map +1 -0
- package/Terminal/TerminalColors.js +151 -0
- package/Terminal/TerminalColors.js.map +1 -0
- package/Terminal/TerminalSymbolType.d.ts +2 -0
- package/Terminal/TerminalSymbolType.d.ts.map +1 -0
- package/Terminal/TerminalSymbolType.js +3 -0
- package/Terminal/TerminalSymbolType.js.map +1 -0
- package/Terminal/TerminalSymbols.d.ts +7 -0
- package/Terminal/TerminalSymbols.d.ts.map +1 -0
- package/Terminal/TerminalSymbols.js +30 -0
- package/Terminal/TerminalSymbols.js.map +1 -0
- package/package.json +26 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TerminalColorType } from '../../Terminal/TerminalColorType';
|
|
2
|
+
import type { ILogEntry } from '../Interfaces/ILogEntry';
|
|
3
|
+
import { Appender } from './Abstracts/Appender';
|
|
4
|
+
import type { IAppenderConfig } from './Interfaces/IAppenderConfig';
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface ITimeStampAppenderConfig extends IAppenderConfig {
|
|
9
|
+
terminalColors: Array<TerminalColorType>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare class TimeStampAppender extends Appender<ITimeStampAppenderConfig> {
|
|
15
|
+
private _terminalColors;
|
|
16
|
+
constructor();
|
|
17
|
+
get terminalColors(): Array<TerminalColorType>;
|
|
18
|
+
initialize(config: ITimeStampAppenderConfig): void;
|
|
19
|
+
append(entry: ILogEntry): void;
|
|
20
|
+
private appendTerminalColor;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=TimeStampAppender.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeStampAppender.d.ts","sourceRoot":"","sources":["../../../src/Logging/Appenders/TimeStampAppender.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIpE;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAI7D,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;CAG5C;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ,CAAC,wBAAwB,CAAC;IAIrE,OAAO,CAAC,eAAe,CAA2B;;IAelD,IAAW,cAAc,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAEpD;IAMe,UAAU,CAAC,MAAM,EAAE,wBAAwB,GAAG,IAAI;IAI3D,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAOrC,OAAO,CAAC,mBAAmB;CAW9B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TimeStampAppender = void 0;
|
|
5
|
+
const TerminalColors_1 = require("../../Terminal/TerminalColors");
|
|
6
|
+
const Appender_1 = require("./Abstracts/Appender");
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
class TimeStampAppender extends Appender_1.Appender {
|
|
11
|
+
// #region Fields
|
|
12
|
+
_terminalColors;
|
|
13
|
+
// #endregion
|
|
14
|
+
// #region Ctor
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this._terminalColors = new Array();
|
|
18
|
+
}
|
|
19
|
+
// #endregion
|
|
20
|
+
// #region Properties
|
|
21
|
+
get terminalColors() {
|
|
22
|
+
return this._terminalColors;
|
|
23
|
+
}
|
|
24
|
+
// #endregion
|
|
25
|
+
// #region Methods
|
|
26
|
+
initialize(config) {
|
|
27
|
+
this._terminalColors = config.terminalColors;
|
|
28
|
+
}
|
|
29
|
+
append(entry) {
|
|
30
|
+
const date = new Date(entry.timestamp);
|
|
31
|
+
const dateString = `[${date.toString()}]`;
|
|
32
|
+
entry.message = `${this.appendTerminalColor(dateString)} ${entry.message ?? ''}`;
|
|
33
|
+
}
|
|
34
|
+
appendTerminalColor(value) {
|
|
35
|
+
if (this._terminalColors) {
|
|
36
|
+
this._terminalColors.forEach((x) => {
|
|
37
|
+
value = TerminalColors_1.TerminalColors.format(value, x);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.TimeStampAppender = TimeStampAppender;
|
|
44
|
+
//# sourceMappingURL=TimeStampAppender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeStampAppender.js","sourceRoot":"","sources":["../../../src/Logging/Appenders/TimeStampAppender.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAElB,kEAA+D;AAG/D,mDAAgD;AAiBhD;;GAEG;AACH,MAAa,iBAAkB,SAAQ,mBAAkC;IAErE,iBAAiB;IAET,eAAe,CAA2B;IAElD,aAAa;IAEb,eAAe;IAEf;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,eAAe,GAAG,IAAI,KAAK,EAAqB,CAAC;IAC1D,CAAC;IAED,aAAa;IAEb,qBAAqB;IAErB,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,aAAa;IAEb,kBAAkB;IAEF,UAAU,CAAC,MAAgC;QACvD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC;IACjD,CAAC;IAEM,MAAM,CAAC,KAAgB;QAC1B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACvC,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;QAE1C,KAAK,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;IACrF,CAAC;IAEO,mBAAmB,CAAC,KAAa;QACrC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACvB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC/B,KAAK,GAAG,+BAAc,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;QACP,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CAIJ;AAjDD,8CAiDC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LogLevel } from '../LogLevel';
|
|
2
|
+
import type { ILogOptions } from './ILogOptions';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface ILogEntry {
|
|
7
|
+
level: LogLevel;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
message?: string;
|
|
10
|
+
exception?: Error;
|
|
11
|
+
options?: Partial<ILogOptions>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ILogEntry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILogEntry.d.ts","sourceRoot":"","sources":["../../../src/Logging/Interfaces/ILogEntry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD;;GAEG;AACH,MAAM,WAAW,SAAS;IAItB,KAAK,EAAE,QAAQ,CAAC;IAEhB,SAAS,EAAE,MAAM,CAAC;IAElB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,SAAS,CAAC,EAAE,KAAK,CAAC;IAElB,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAIlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILogEntry.js","sourceRoot":"","sources":["../../../src/Logging/Interfaces/ILogEntry.ts"],"names":[],"mappings":";AAAA,kBAAkB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TerminalColorType } from '../../Terminal/TerminalColorType';
|
|
2
|
+
import type { IAppender } from '../Appenders/Interfaces/IAppender';
|
|
3
|
+
import type { IAppenderConfig } from '../Appenders/Interfaces/IAppenderConfig';
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface ILogOptions {
|
|
8
|
+
prefixSpaceLength?: number;
|
|
9
|
+
suffixSpaceLength?: number;
|
|
10
|
+
noNewLine?: boolean;
|
|
11
|
+
appenders?: Array<new () => IAppender<IAppenderConfig>>;
|
|
12
|
+
/**
|
|
13
|
+
* override termial color.
|
|
14
|
+
*/
|
|
15
|
+
color?: TerminalColorType | Array<TerminalColorType>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ILogOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILogOptions.d.ts","sourceRoot":"","sources":["../../../src/Logging/Interfaces/ILogOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAI/E;;GAEG;AACH,MAAM,WAAW,WAAW;IAIxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,SAAS,CAAC,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC;IAExD;;OAEG;IACH,KAAK,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC;CAIxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILogOptions.js","sourceRoot":"","sources":["../../../src/Logging/Interfaces/ILogOptions.ts"],"names":[],"mappings":";AAAA,kBAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILoggerScope.d.ts","sourceRoot":"","sources":["../../../src/Logging/Interfaces/ILoggerScope.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAIzB,OAAO,IAAI,IAAI,CAAC;CAInB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILoggerScope.js","sourceRoot":"","sources":["../../../src/Logging/Interfaces/ILoggerScope.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TerminalColorType } from '../../Terminal/TerminalColorType';
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export interface ILoggerScopeConfig {
|
|
6
|
+
prefixSpaceLength?: number;
|
|
7
|
+
color?: TerminalColorType | Array<TerminalColorType>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=ILoggerScopeConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILoggerScopeConfig.d.ts","sourceRoot":"","sources":["../../../src/Logging/Interfaces/ILoggerScopeConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAI1E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAI/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,KAAK,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC;CAIxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILoggerScopeConfig.js","sourceRoot":"","sources":["../../../src/Logging/Interfaces/ILoggerScopeConfig.ts"],"names":[],"mappings":";AAAA,kBAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogLevel.d.ts","sourceRoot":"","sources":["../../src/Logging/LogLevel.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogLevel.js","sourceRoot":"","sources":["../../src/Logging/LogLevel.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { ILogEntry } from './Interfaces/ILogEntry';
|
|
2
|
+
import type { ILoggerScope } from './Interfaces/ILoggerScope';
|
|
3
|
+
import type { ILoggerScopeConfig } from './Interfaces/ILoggerScopeConfig';
|
|
4
|
+
import type { ILogOptions } from './Interfaces/ILogOptions';
|
|
5
|
+
import { LoggerConfig } from './LoggerConfig';
|
|
6
|
+
import type { LogLevel } from './LogLevel';
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class Logger {
|
|
11
|
+
private static _config;
|
|
12
|
+
private static _logger;
|
|
13
|
+
private readonly _name;
|
|
14
|
+
private readonly _parent;
|
|
15
|
+
private readonly _config;
|
|
16
|
+
private _suppressor;
|
|
17
|
+
private _appender;
|
|
18
|
+
private _isDebug;
|
|
19
|
+
private _quiet;
|
|
20
|
+
private _cb;
|
|
21
|
+
constructor(name: string, parent?: Logger | null, config?: LoggerConfig);
|
|
22
|
+
get name(): string;
|
|
23
|
+
get parent(): Logger | null;
|
|
24
|
+
/**
|
|
25
|
+
* Configure the logger.
|
|
26
|
+
*
|
|
27
|
+
* @static
|
|
28
|
+
* @param {LoggerConfig?} config The logger configuration.
|
|
29
|
+
* @param {boolean} force Override the logger configuration.
|
|
30
|
+
* @returns {Logger}
|
|
31
|
+
*/
|
|
32
|
+
static configure(config?: Partial<LoggerConfig>, force?: boolean): Logger;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a instance of the logger object.
|
|
35
|
+
*
|
|
36
|
+
* @static
|
|
37
|
+
* @returns {Logger} A logger object
|
|
38
|
+
*/
|
|
39
|
+
static instance(): Logger;
|
|
40
|
+
/**
|
|
41
|
+
* Configure the logger.
|
|
42
|
+
*
|
|
43
|
+
* @param {LoggerConfig?} config The logger configuration.
|
|
44
|
+
*/
|
|
45
|
+
configure(config?: Partial<LoggerConfig>): void;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new child logger instance.
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
* @param {string} name The logger name
|
|
51
|
+
* @returns {Logger} A logger object
|
|
52
|
+
*/
|
|
53
|
+
createChild(name: string, config?: LoggerConfig): Logger;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new logger scope instance.
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
* @param {string} message The logger scope message.
|
|
59
|
+
* @returns {ILoggerScope} A logger scope object.
|
|
60
|
+
*/
|
|
61
|
+
createScope(message?: string, config?: Partial<ILoggerScopeConfig>): ILoggerScope;
|
|
62
|
+
/**
|
|
63
|
+
* Add a subscription to each log.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
* @param {Function} cb The subsciption callback.
|
|
67
|
+
*/
|
|
68
|
+
subscribe(cb: (entry: ILogEntry) => void): void;
|
|
69
|
+
/**
|
|
70
|
+
* Logs a message.
|
|
71
|
+
*
|
|
72
|
+
* @public
|
|
73
|
+
* @param {LogLevel} level The state
|
|
74
|
+
* @param {string} message The message
|
|
75
|
+
* @param {ILogOptions} options The custom log options
|
|
76
|
+
* @returns {Logger} A logger object
|
|
77
|
+
*/
|
|
78
|
+
log(level: LogLevel, message: string, options?: Partial<ILogOptions>): this;
|
|
79
|
+
/**
|
|
80
|
+
* Logs a debug message.
|
|
81
|
+
* Formatting is removed.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
* @param {string} message The message
|
|
85
|
+
* @param {ILogOptions} options The custom log options
|
|
86
|
+
* @returns {Logger} A logger object
|
|
87
|
+
*/
|
|
88
|
+
logDebug(message: string, options?: ILogOptions): this;
|
|
89
|
+
/**
|
|
90
|
+
* Logs a info message.
|
|
91
|
+
* Formatting is removed.
|
|
92
|
+
*
|
|
93
|
+
* @public
|
|
94
|
+
* @param {string} message The message
|
|
95
|
+
* @param {ILogOptions} options The custom log options
|
|
96
|
+
* @returns {Logger} A logger object
|
|
97
|
+
*/
|
|
98
|
+
logInfo(message: string, options?: ILogOptions): this;
|
|
99
|
+
/**
|
|
100
|
+
* Logs a waring message.
|
|
101
|
+
* Formatting is removed.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
* @param {string} message The message
|
|
105
|
+
* @param {ILogOptions} options The custom log options
|
|
106
|
+
* @returns {Logger} A logger object
|
|
107
|
+
*/
|
|
108
|
+
logWarning(message: string, options?: ILogOptions): this;
|
|
109
|
+
/**
|
|
110
|
+
* Logs a error message.
|
|
111
|
+
* Formatting is removed.
|
|
112
|
+
*
|
|
113
|
+
* @public
|
|
114
|
+
* @param {string} message The message
|
|
115
|
+
* @param {ILogOptions} options The custom log options
|
|
116
|
+
* @returns {Logger} A logger object
|
|
117
|
+
*/
|
|
118
|
+
logError(message: string, options?: ILogOptions): this;
|
|
119
|
+
/**
|
|
120
|
+
* Logs a fatal message.
|
|
121
|
+
* Formatting is removed.
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
* @param {string} message The message
|
|
125
|
+
* @param {ILogOptions} options The custom log options
|
|
126
|
+
* @returns {Logger} A logger object
|
|
127
|
+
*/
|
|
128
|
+
logFatal(message: string, options?: ILogOptions): this;
|
|
129
|
+
/**
|
|
130
|
+
* Logs a neutral message.
|
|
131
|
+
* Formatting is not removed.
|
|
132
|
+
*
|
|
133
|
+
* @public
|
|
134
|
+
* @param {string} message The message
|
|
135
|
+
* @param {ILogOptions} options The custom log options
|
|
136
|
+
* @returns {Logger} A logger object
|
|
137
|
+
*/
|
|
138
|
+
logNeutral(message: string, options?: ILogOptions): this;
|
|
139
|
+
/**
|
|
140
|
+
* @private
|
|
141
|
+
*/
|
|
142
|
+
private ensure;
|
|
143
|
+
/**
|
|
144
|
+
* @private
|
|
145
|
+
*/
|
|
146
|
+
private logCore;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/Logging/Logger.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAI3C;;GAEG;AACH,qBAAa,MAAM;IAIf,OAAO,CAAC,MAAM,CAAC,OAAO,CAAe;IACrC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAC9C,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,SAAS,CAA8D;IAC/E,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,GAAG,CAAsC;gBAM9B,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW,EAAE,MAAM,CAAC,EAAE,YAAY;IAwBpF,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,MAAM,IAAI,MAAM,GAAG,IAAI,CAEjC;IAMD;;;;;;;OAOG;WACW,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM;IAYhF;;;;;OAKG;WACW,QAAQ,IAAI,MAAM;IAchC;;;;OAIG;IACI,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI;IA0BtD;;;;;;OAMG;IACI,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM;IAK/D;;;;;;OAMG;IACI,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,YAAY;IAIxF;;;;;OAKG;IACI,SAAS,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GAAG,IAAI;IAItD;;;;;;;;OAQG;IACI,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;IAmClF;;;;;;;;OAQG;IACI,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI;IAS7D;;;;;;;;OAQG;IACI,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI;IAS5D;;;;;;;;OAQG;IACI,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI;IAS/D;;;;;;;;OAQG;IACI,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI;IAS7D;;;;;;;;OAQG;IACI,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI;IAS7D;;;;;;;;OAQG;IACI,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI;IAI/D;;OAEG;IACH,OAAO,CAAC,MAAM;IAed;;OAEG;IACH,OAAO,CAAC,OAAO;CA6BlB"}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Logger = void 0;
|
|
5
|
+
const TerminalColors_1 = require("../Terminal/TerminalColors");
|
|
6
|
+
const LoggerConfig_1 = require("./LoggerConfig");
|
|
7
|
+
const LoggerScope_1 = require("./LoggerScope");
|
|
8
|
+
const LoggerSuppressor_1 = require("./LoggerSuppressor");
|
|
9
|
+
// #endregion
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
class Logger {
|
|
14
|
+
// #region Fields
|
|
15
|
+
static _config;
|
|
16
|
+
static _logger;
|
|
17
|
+
_name;
|
|
18
|
+
_parent;
|
|
19
|
+
_config;
|
|
20
|
+
_suppressor;
|
|
21
|
+
_appender;
|
|
22
|
+
_isDebug;
|
|
23
|
+
_quiet;
|
|
24
|
+
_cb;
|
|
25
|
+
// #endregion
|
|
26
|
+
// #region Ctor
|
|
27
|
+
constructor(name, parent = null, config) {
|
|
28
|
+
this._name = name;
|
|
29
|
+
this._parent = parent;
|
|
30
|
+
this._suppressor = null;
|
|
31
|
+
this._cb = null;
|
|
32
|
+
this._appender = null;
|
|
33
|
+
this._isDebug = false;
|
|
34
|
+
this._quiet = false;
|
|
35
|
+
const path = [];
|
|
36
|
+
let p = parent;
|
|
37
|
+
while (p) {
|
|
38
|
+
path.push(p.name);
|
|
39
|
+
p = p.parent;
|
|
40
|
+
}
|
|
41
|
+
this._config = config ?? null;
|
|
42
|
+
this.configure(config);
|
|
43
|
+
}
|
|
44
|
+
// #endregion
|
|
45
|
+
// #region Properties
|
|
46
|
+
get name() {
|
|
47
|
+
return this._name;
|
|
48
|
+
}
|
|
49
|
+
get parent() {
|
|
50
|
+
return this._parent;
|
|
51
|
+
}
|
|
52
|
+
// #endregion
|
|
53
|
+
// #region Methods
|
|
54
|
+
/**
|
|
55
|
+
* Configure the logger.
|
|
56
|
+
*
|
|
57
|
+
* @static
|
|
58
|
+
* @param {LoggerConfig?} config The logger configuration.
|
|
59
|
+
* @param {boolean} force Override the logger configuration.
|
|
60
|
+
* @returns {Logger}
|
|
61
|
+
*/
|
|
62
|
+
static configure(config, force) {
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
64
|
+
if (Logger._config && !force) {
|
|
65
|
+
throw new Error('The logger is already configured!');
|
|
66
|
+
}
|
|
67
|
+
Logger._config = config
|
|
68
|
+
? Object.assign(new LoggerConfig_1.LoggerConfig(), config)
|
|
69
|
+
: new LoggerConfig_1.LoggerConfig();
|
|
70
|
+
return Logger.instance();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates a instance of the logger object.
|
|
74
|
+
*
|
|
75
|
+
* @static
|
|
76
|
+
* @returns {Logger} A logger object
|
|
77
|
+
*/
|
|
78
|
+
static instance() {
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
80
|
+
if (!Logger._logger) {
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
82
|
+
if (!Logger._config) {
|
|
83
|
+
throw new Error('The logger must be configured, before it would be used!');
|
|
84
|
+
}
|
|
85
|
+
return Logger._logger = new Logger('');
|
|
86
|
+
}
|
|
87
|
+
return Logger._logger;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Configure the logger.
|
|
91
|
+
*
|
|
92
|
+
* @param {LoggerConfig?} config The logger configuration.
|
|
93
|
+
*/
|
|
94
|
+
configure(config) {
|
|
95
|
+
if (this._config) {
|
|
96
|
+
config = Object.assign(this._config, config);
|
|
97
|
+
}
|
|
98
|
+
if (config) {
|
|
99
|
+
this._isDebug = config.isDebug ?? false;
|
|
100
|
+
this._quiet = config.quiet ?? false;
|
|
101
|
+
this._suppressor = config.overrideConsole ?? false
|
|
102
|
+
? new LoggerSuppressor_1.LoggerSuppressor().suppress()
|
|
103
|
+
: null;
|
|
104
|
+
this._appender = (config.appender ?? []).length > 0
|
|
105
|
+
? (config.appender ?? []).map((x) => [new x[0](), x[1]])
|
|
106
|
+
: null;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
this._isDebug = false;
|
|
110
|
+
this._quiet = false;
|
|
111
|
+
this._suppressor = null;
|
|
112
|
+
this._appender = null;
|
|
113
|
+
}
|
|
114
|
+
this._appender?.forEach((x) => {
|
|
115
|
+
x[0].initialize(x[1]);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Creates a new child logger instance.
|
|
120
|
+
*
|
|
121
|
+
* @public
|
|
122
|
+
* @param {string} name The logger name
|
|
123
|
+
* @returns {Logger} A logger object
|
|
124
|
+
*/
|
|
125
|
+
createChild(name, config) {
|
|
126
|
+
// Todo: adapt config from parent logger if is not set.
|
|
127
|
+
return new this.constructor(name, this, config);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Creates a new logger scope instance.
|
|
131
|
+
*
|
|
132
|
+
* @public
|
|
133
|
+
* @param {string} message The logger scope message.
|
|
134
|
+
* @returns {ILoggerScope} A logger scope object.
|
|
135
|
+
*/
|
|
136
|
+
createScope(message, config) {
|
|
137
|
+
return new LoggerScope_1.LoggerScope(message, config);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Add a subscription to each log.
|
|
141
|
+
*
|
|
142
|
+
* @public
|
|
143
|
+
* @param {Function} cb The subsciption callback.
|
|
144
|
+
*/
|
|
145
|
+
subscribe(cb) {
|
|
146
|
+
this._cb = cb;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Logs a message.
|
|
150
|
+
*
|
|
151
|
+
* @public
|
|
152
|
+
* @param {LogLevel} level The state
|
|
153
|
+
* @param {string} message The message
|
|
154
|
+
* @param {ILogOptions} options The custom log options
|
|
155
|
+
* @returns {Logger} A logger object
|
|
156
|
+
*/
|
|
157
|
+
log(level, message, options) {
|
|
158
|
+
if (this._quiet) {
|
|
159
|
+
return this;
|
|
160
|
+
}
|
|
161
|
+
if (level === 'debug' && !this._isDebug) {
|
|
162
|
+
console.log('log was rejected!!!');
|
|
163
|
+
return this;
|
|
164
|
+
}
|
|
165
|
+
options = this.ensure(options);
|
|
166
|
+
const entry = {
|
|
167
|
+
level,
|
|
168
|
+
message,
|
|
169
|
+
options,
|
|
170
|
+
timestamp: Number(Date.now())
|
|
171
|
+
};
|
|
172
|
+
this._appender?.forEach(([appender]) => {
|
|
173
|
+
appender.append(entry);
|
|
174
|
+
});
|
|
175
|
+
if (this._suppressor) {
|
|
176
|
+
this._suppressor.getMethod('log')(entry.message);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
this.logCore(entry.message ?? '', options);
|
|
180
|
+
}
|
|
181
|
+
if (this._cb) {
|
|
182
|
+
this._cb(entry);
|
|
183
|
+
}
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Logs a debug message.
|
|
188
|
+
* Formatting is removed.
|
|
189
|
+
*
|
|
190
|
+
* @public
|
|
191
|
+
* @param {string} message The message
|
|
192
|
+
* @param {ILogOptions} options The custom log options
|
|
193
|
+
* @returns {Logger} A logger object
|
|
194
|
+
*/
|
|
195
|
+
logDebug(message, options) {
|
|
196
|
+
return this.log('debug', message, {
|
|
197
|
+
...{
|
|
198
|
+
color: 'gray'
|
|
199
|
+
},
|
|
200
|
+
...options
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Logs a info message.
|
|
205
|
+
* Formatting is removed.
|
|
206
|
+
*
|
|
207
|
+
* @public
|
|
208
|
+
* @param {string} message The message
|
|
209
|
+
* @param {ILogOptions} options The custom log options
|
|
210
|
+
* @returns {Logger} A logger object
|
|
211
|
+
*/
|
|
212
|
+
logInfo(message, options) {
|
|
213
|
+
return this.log('info', message, {
|
|
214
|
+
...{
|
|
215
|
+
color: 'blue'
|
|
216
|
+
},
|
|
217
|
+
...options
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Logs a waring message.
|
|
222
|
+
* Formatting is removed.
|
|
223
|
+
*
|
|
224
|
+
* @public
|
|
225
|
+
* @param {string} message The message
|
|
226
|
+
* @param {ILogOptions} options The custom log options
|
|
227
|
+
* @returns {Logger} A logger object
|
|
228
|
+
*/
|
|
229
|
+
logWarning(message, options) {
|
|
230
|
+
return this.log('warn', message, {
|
|
231
|
+
...{
|
|
232
|
+
color: 'yellow'
|
|
233
|
+
},
|
|
234
|
+
...options
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Logs a error message.
|
|
239
|
+
* Formatting is removed.
|
|
240
|
+
*
|
|
241
|
+
* @public
|
|
242
|
+
* @param {string} message The message
|
|
243
|
+
* @param {ILogOptions} options The custom log options
|
|
244
|
+
* @returns {Logger} A logger object
|
|
245
|
+
*/
|
|
246
|
+
logError(message, options) {
|
|
247
|
+
return this.log('error', message, {
|
|
248
|
+
...{
|
|
249
|
+
color: 'red'
|
|
250
|
+
},
|
|
251
|
+
...options
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Logs a fatal message.
|
|
256
|
+
* Formatting is removed.
|
|
257
|
+
*
|
|
258
|
+
* @public
|
|
259
|
+
* @param {string} message The message
|
|
260
|
+
* @param {ILogOptions} options The custom log options
|
|
261
|
+
* @returns {Logger} A logger object
|
|
262
|
+
*/
|
|
263
|
+
logFatal(message, options) {
|
|
264
|
+
return this.log('fatal', message, {
|
|
265
|
+
...{
|
|
266
|
+
color: 'red'
|
|
267
|
+
},
|
|
268
|
+
...options
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Logs a neutral message.
|
|
273
|
+
* Formatting is not removed.
|
|
274
|
+
*
|
|
275
|
+
* @public
|
|
276
|
+
* @param {string} message The message
|
|
277
|
+
* @param {ILogOptions} options The custom log options
|
|
278
|
+
* @returns {Logger} A logger object
|
|
279
|
+
*/
|
|
280
|
+
logNeutral(message, options) {
|
|
281
|
+
return this.log('none', message, options);
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* @private
|
|
285
|
+
*/
|
|
286
|
+
ensure(options) {
|
|
287
|
+
const defaultOptions = {
|
|
288
|
+
noNewLine: false,
|
|
289
|
+
prefixSpaceLength: 0,
|
|
290
|
+
suffixSpaceLength: 0,
|
|
291
|
+
appenders: []
|
|
292
|
+
};
|
|
293
|
+
return options
|
|
294
|
+
? {
|
|
295
|
+
...defaultOptions,
|
|
296
|
+
...options
|
|
297
|
+
}
|
|
298
|
+
: defaultOptions;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* @private
|
|
302
|
+
*/
|
|
303
|
+
logCore(msg, options) {
|
|
304
|
+
if (options.color) {
|
|
305
|
+
// eslint-disable-next-line no-control-regex
|
|
306
|
+
msg = msg.replace(/\x1B\[\d+m/g, '');
|
|
307
|
+
}
|
|
308
|
+
const chunkSize = 2000; // Small chunk.
|
|
309
|
+
const prefix = options.prefixSpaceLength ? ' '.repeat(options.prefixSpaceLength) : '';
|
|
310
|
+
const suffix = options.suffixSpaceLength ? ' '.repeat(options.suffixSpaceLength) : '';
|
|
311
|
+
while (msg) {
|
|
312
|
+
let chunk = msg.slice(0, chunkSize);
|
|
313
|
+
if (options.color) {
|
|
314
|
+
const c = Array.isArray(options.color) ? options.color : [options.color];
|
|
315
|
+
chunk = TerminalColors_1.TerminalColors.format(chunk, ...c);
|
|
316
|
+
}
|
|
317
|
+
if (options.noNewLine) {
|
|
318
|
+
chunk = `${chunk}${options.noNewLine ? '\u001b[2K\u001b[0E' : ''}`;
|
|
319
|
+
}
|
|
320
|
+
msg = msg.slice(chunkSize);
|
|
321
|
+
console.log(`${prefix}${chunk}${suffix}`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
exports.Logger = Logger;
|
|
326
|
+
//# sourceMappingURL=Logger.js.map
|