import * as i1 from '@angular/common/http'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import * as i0 from '@angular/core'; /** Defines the interface to the log publishers. */ interface TbxILogWriter { /** * Logs a debug message. * @param message The message to log. * @param optionalParams Any optional parameters. */ debug(message: string, ...optionalParams: any[]): void; /** * Logs an information message. * @param message - The message to log. * @param optionalParams - Any optional parameters. */ info(message: string, ...optionalParams: any[]): void; /** * Logs a warning message. * @param message - The message to log. * @param optionalParams - Any optional parameters. */ warn(message: string, ...optionalParams: any[]): void; /** * Logs an error message. * @param message - The message to log. * @param optionalParams - Any optional parameters. */ error(message: string, ...optionalParams: any[]): void; /** * Logs a fatal message. * @param message - The message to log. * @param optionalParams - Any optional parameters. */ fatal(message: string, ...optionalParams: any[]): void; /** * Logs a general message. * @param message - The message to log. * @param optionalParams - Any optional parameters. */ log(message: string, ...optionalParams: any[]): void; /** Clears all entries from the publishers. */ clear(): void; } /** * Enumerates the different types of log entries that can be added to the log. * These levels match that of the .NET ToolBox log service. */ declare enum TbxLogEntryType { /** Type indicates the entry is the start of a process, and it will be completed. */ pending = 0, /** Type indicates the entry is the completion of a process. */ completed = 1, /** Type indicates the entry is an error entry. */ error = 2, /** Type indicates the entry is just a regular entry. */ info = 3, /** Type indicates the entry is a warning entry. */ warning = 4, /** Type indicates the entry should not be logged. */ none = 5 } /** * Entity to model records in the application's global log. */ declare class TbxLogEntry { /** Gets or sets a unique ID for the entry. */ entryId: string; /** Gets or sets the date of the entry. */ entryDate: Date; /** Gets or sets the entry's main content. */ message: string; /** Gets or sets the area where the entry originated from. */ area: string; /** Gets or sets the user who logged the entry. */ userName: string; /** Gets or sets a value indicating whether the entry is fatal. */ isFatal: boolean; /** Gets or sets the type of log entry this is. */ entryType: TbxLogEntryType; /** * Initializes a new instance of the {@link TbxLogEntry} class. * @param message The message to log. * @returns Nothing. */ constructor(message?: string); /** * Formats the data in a standard log line. * @returns A line formatted as a standard entry for Lacera logs. */ toString(): string; } /** Enumerates the different levels of logging. */ declare enum TbxLogLevel { /** Log only debug entries and up. */ debug = 0, /** log only information entries and up. */ information = 1, /** Log only warning entries and up. */ warning = 2, /** Log only error entries and up. */ error = 3, /** Log only fatal entries and up. */ fatal = 4, /** Turn off all logging. */ off = 5 } /** Defines the available log publisher names. */ type TbxLogPublisherName = "console" | "webapi" | "localstorage" | ""; /** Provides functions to obtain application information such as name, version, etc. */ declare abstract class TbxLogPublisher { /** Gets or Sets the name of the logger. */ logName: TbxLogPublisherName; /** Gets or Sets the log level for this publisher. */ logLevel: TbxLogLevel; /** Gets or Sets the location of the log entries. */ location: string; /** * Logs the entry to the location. * @param entry - The entry to log. * @returns The action result. */ abstract log(entry: TbxLogEntry): Observable | boolean; /** * Clears all entries from the location. * @returns The action result. */ abstract clear(): Observable | boolean; } /** Manages the available publishers. */ declare class TbxLogPublishersService { private readonly http; private configuredPublishers; constructor(http: HttpClient); /** Gets the configured publishers. */ get publishers(): TbxLogPublisher[]; /** Sets the configured publishers. */ set publishers(publishers: TbxLogPublisher[]); /** * Handles an errors when publishing to the server. * @returns The action result. */ private static handleErrors; /** Builds the publishers to use based on the configuration. */ buildPublishers(): void; /** * Gets the loggers from the publisher configuration file. * @returns The configured publishers. */ private getLoggers; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** Provides functions to add log entries to various publishers. */ declare class TbxLogService implements TbxILogWriter { protected readonly publishersService: TbxLogPublishersService; /** * Initializes a new instance of the {@link TbxLogService} class. * @param publishersService The log publishers service. */ constructor(publishersService: TbxLogPublishersService); /** Gets the registered publishers. */ get publishers(): TbxLogPublisher[]; /** * Logs a debug message. * @param message The message to log. * @param optionalParams Any optional parameters. */ debug(message: string, ...optionalParams: any[]): void; /** * Logs an information message. * @param message - The message to log. * @param optionalParams - Any optional parameters. */ info(message: string, ...optionalParams: any[]): void; /** * Logs a warning message. * @param message - The message to log. * @param optionalParams - Any optional parameters. */ warn(message: string, ...optionalParams: any[]): void; /** * Logs an error message. * @param message - The message to log. * @param optionalParams - Any optional parameters. */ error(message: string, ...optionalParams: any[]): void; /** * Logs a fatal message. * @param message - The message to log. * @param optionalParams - Any optional parameters. */ fatal(message: string, ...optionalParams: any[]): void; /** * Logs a general message. * @param message - The message to log. * @param optionalParams - Any optional parameters. */ log(message: string, ...optionalParams: any[]): void; /** Clears all entries from the publishers. */ clear(): void; /** * Determines if the entry should be logged based on settings. * @param level The log level of the entry. * @returns True if the entry should be logged, false otherwise. */ shouldLog(level: TbxLogLevel): boolean; /** * Determines the log entry type based on the log level. * @param level - The log level. * @returns The log entry type. */ protected static getEntryType(level: TbxLogLevel): TbxLogEntryType; /** * Formats the optional parameters into a string. * @param params - Any optional parameters. * @returns The string with optional parameters */ protected static formatParams(params: any[]): string; /** * Performs the actual write to the publishers. * @param message - The message to log. * @param level - The log level. * @param params - Any optional parameters. */ protected writeToLog(message: string, level: TbxLogLevel, params: any[]): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Provides functions to log entries to the console. */ declare class TbxLogConsole extends TbxLogPublisher { /** * Converts the entry to a string for the console. * @param entry The entry to stringify. * @returns The entry converted to a string. */ private static getString; /** * Logs the entry to the location. * @param entry - The entry to log. * @returns The action result. */ log(entry: TbxLogEntry): boolean; /** * Clears all entries from the location. * @returns The action result. */ clear(): boolean; } /** * Provides functions to log entries to the local storage. */ declare class TbxLogLocalStorage extends TbxLogPublisher { /** * Initializes a new instance of the {@link TbxLogLocalStorage} class. */ constructor(); /** * Gets all log entries in local storage. * @returns All log entries found in local storage. */ getAll(): TbxLogEntry[]; /** * Logs the entry to the location. * @param entry - The entry to log. * @returns True if the entry was written, false otherwise. */ log(entry: TbxLogEntry): boolean; /** * Clears all entries from the location. * @returns The action result. */ clear(): boolean; } /** * Provides functions to log entries to the back-end server. */ declare class TbxLogWebApi extends TbxLogPublisher { private readonly http; /** * Initializes a new instance of the {@link TbxLogWebApi} class. * @param http - The Angular http client. */ constructor(http: HttpClient); /** * Logs the entry to the location. * @param entry - The entry to log. * @returns The action result. */ log(entry: TbxLogEntry): Observable | boolean; /** * Clears all entries from the location. * @returns The action result. */ clear(): Observable | boolean; } /** * The configuration for a log publisher. */ declare class TbxLogPublisherConfig { /** Gets or sets the name of the logger. */ loggerName: TbxLogPublisherName; /** Gets or sets the location where the entries are logged. */ loggerLocation: string; /** Gets or sets a value indicating whether the logger is active. */ isActive: boolean; } declare class TbxLoggingModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { TbxLogConsole, TbxLogEntry, TbxLogEntryType, TbxLogLevel, TbxLogLocalStorage, TbxLogPublisher, TbxLogPublisherConfig, TbxLogPublishersService, TbxLogService, TbxLogWebApi, TbxLoggingModule }; export type { TbxILogWriter, TbxLogPublisherName };