
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@zcodeapp/logger
Advanced tools
This TypeScript Logger class is part of the @zcodeapp packages. It offers a flexible logging system with support for different logging strategies and levels.
getInstance method.Include the Logger class in your TypeScript project:
npm install @zcodeapp/logger
First, import the Logger class and other necessary interfaces:
import { Logger, ELoggerLevel, ILoggerOptions, LoggerStrategyConsole } from "@zcodeapp/interfaces";
Then, configure and use the logger:
// Configure Logger
const loggerOptions: ILoggerOptions = {
level: ELoggerLevel.DEBUG,
strategy: new LoggerStrategyConsole(),
// other options...
};
const logger = Logger.getInstance(loggerOptions);
// Use Logger
logger.debug("Debug message");
logger.info("Info message");
logger.warn("Warning message");
logger.error("Error message");
logger.fatal("Fatal message");
Logger.getInstance(options?: ILoggerOptions): ILogger
Returns a singleton instance of the Logger. If options is provided, it configures the logger accordingly.
configure(options: ILoggerOptions): void
Configures the logger with the given options.
getOptions(): ILoggerOptions
Returns the current logger options.
addPrefix(prefix: string): void
Adds a prefix to all log messages.
debug(message: string, params?: any): voidinfo(message: string, params?: any): voidwarn(message: string, params?: any): voiderror(message: string, params?: any): voidfatal(message: string, params?: any): voidILoggerOptions ReferenceILoggerOptions is an interface that provides various configuration options for the Logger. Below are the details of each option available:
level (ELoggerLevel): This option sets the logging level for the logger. The available levels are:
DEBUG: Logs detailed information, primarily useful for developers.INFORMATION: Logs informative messages that highlight the progress of the application.WARNING: Logs potentially harmful situations.ERROR: Logs error events that might still allow the application to continue running.FATAL: Logs severe error events that presumably lead the application to abort.strategy: Defines the strategy for logging messages. This can be an instance of any class that implements the logging strategy, like LoggerStrategyConsole. The strategy default determines how and where the log messages are outputted.
prefix (string): An optional string that is prepended to every log message. This is useful for tagging logs with specific identifiers like module names or environment names.
newInstance (boolean): An optional flag to create a new logger instance instead of using the singleton pattern. By default, Logger uses a singleton pattern, and this flag is set to false.
Here's an example of how to configure the Logger with ILoggerOptions:
const options: ILoggerOptions = {
level: ELoggerLevel.DEBUG,
strategy: new LoggerStrategyConsole(),
prefix: "MyApp",
newInstance: true
};
const logger = Logger.getInstance(options);
logger.info("Application started");
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Logger for application
We found that @zcodeapp/logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.