@pnp/logging
- Version 4.5.0
- Published
- 18.7 kB
- 1 dependency
- MIT license
Install
npm i @pnp/logging
yarn add @pnp/logging
pnpm add @pnp/logging
Overview
pnp - light-weight, subscribable logging framework
Index
Functions
function ConsoleListener
ConsoleListener: ( prefix?: string, colors?: IConsoleListenerColors) => ILogListener;
function FunctionListener
FunctionListener: (impl: (entry: ILogEntry) => void) => ILogListener;
function PnPLogging
PnPLogging: <T>(activeLevel: LogLevel) => (o: T) => T;
Classes
class Logger
class Logger {}
Class used to subscribe ILogListener and log messages throughout an application
property activeLogLevel
static activeLogLevel: LogLevel;
Gets or sets the active log level to apply for log filtering
property count
static readonly count: number;
Gets the current subscriber count
method clearSubscribers
static clearSubscribers: () => ILogListener[];
Clears the subscribers collection, returning the collection before modification
method error
static error: (err: Error) => void;
Logs an error object to the subscribed listeners
Parameter err
The error object
method log
static log: (entry: ILogEntry) => void;
Logs the supplied entry to the subscribed listeners
Parameter entry
The message to log
method subscribe
static subscribe: (...listeners: ILogListener[]) => void;
Adds ILogListener instances to the set of subscribed listeners
Parameter listeners
One or more listeners to subscribe to this log
method write
static write: (message: string, level?: LogLevel) => void;
Writes the supplied string to the subscribed listeners
Parameter message
The message to write
Parameter level
[Optional] if supplied will be used as the level of the entry (Default: LogLevel.Info)
method writeJSON
static writeJSON: (json: any, level?: LogLevel) => void;
Writes the supplied string to the subscribed listeners
Parameter json
The json object to stringify and write
Parameter level
[Optional] if supplied will be used as the level of the entry (Default: LogLevel.Info)
Interfaces
interface IConsoleListenerColors
interface IConsoleListenerColors {}
Text color options for use in the ConsoleListener All values can be specified as known names, hex values, rgb, or rgba values
property color
color?: string;
Default text color for all logging levels unless they're specified
property error
error?: string;
Text color to use for messages with LogLevel.Error
property info
info?: string;
Text color to use for messages with LogLevel.Info
property verbose
verbose?: string;
Text color to use for messages with LogLevel.Verbose
property warning
warning?: string;
Text color to use for messages with LogLevel.Warning
interface ILogEntry
interface ILogEntry {}
Interface that defines a log entry
interface ILogListener
interface ILogListener {}
Interface that defines a log listener
method log
log: (entry: ILogEntry) => void;
Any associated data that a given logging listener may choose to log or ignore
Parameter entry
The information to be logged
Enums
Package Files (2)
Dependencies (1)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@pnp/logging
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@pnp/logging)
- HTML<a href="https://www.jsdocs.io/package/@pnp/logging"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3902 ms. - Missing or incorrect documentation? Open an issue for this package.