Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@guiiai/logg
Advanced tools
Yet another simple, nearly zero dependency, structural log compliance logger implementation.
Yet another simple, nearly zero dependency, structural log compliance logger implementation.
npm install @guiiai/logg
import { Format, LogLevel, createLogg, setGlobalFormat, setGlobalLogLevel } from '@guiiai/logg'
setGlobalLogLevel(LogLevel.Debug)
setGlobalFormat(Format.Pretty) // Otherwise it will output JSON
// Create a logger instance with a specific context
const log = createLogg('http/request').useGlobalConfig()
// Log a 404 error with additional fields
log
.withField('requestId', req.id)
.withField('url', req.url)
.error('Resource not found (404)')
createLogg(context: string)
: Creates a new logger instance with the specified context.useGlobalConfig()
: Applies global configuration to the logger instance.child(fields?: Record<string, any>)
: Creates a child logger with additional fields.withContext(context: string)
: Sets the context dynamically. Returns a cloned logger instance.withLogLevel(logLevel: LogLevel)
: Sets the log level dynamically. Returns a cloned logger instance.withLogLevelString(logLevelString: LogLevelString)
: Sets the log level dynamically using string. Returns a cloned logger instance.withFormat(format: Format)
: Sets the format dynamically. Returns a cloned logger instance.withFields(fields: Record<string, any>)
: Alias for child()
.withField(key: string, value: any)
: Adds a single custom field to the log entry.withError(err: Error | unknown)
: Attaches an error object to the log entry.debug(message: any, ...optionalParams: [...any, string?])
: Logs a debug message.verbose(message: any, ...optionalParams: [...any, string?])
: Logs a verbose message.log(message: any, ...optionalParams: any[])
: Logs a general message.error(message: any, stack?: string, ...optionalParams: any[])
: Logs an error message.errorWithError(message: any, err: Error | unknown, ...optionalParams: any[])
: Logs an error message with an error object.warn(message: any, ...optionalParams: [...any, string?])
: Logs a warning message.getGlobalLogLevel()
: Retrieves the global log level.setGlobalLogLevel(logLevel: LogLevel)
: Sets the global log level.getGlobalLogLevelString()
: Retrieves the global log level as a string.setGlobalLogLevelString(logLevelString: LogLevelString)
: Sets the global log level using a string.getGlobalFormat()
: Retrieves the global format.setGlobalFormat(format: Format)
: Sets the global format.LogLevel
: Enum for log levels (Error
, Warning
, Log
, Verbose
, Debug
).LogLevelString
: Enum for log level strings (error
, warn
, log
, verbose
, debug
).Format
: Enum for log formats (JSON
, Pretty
).FAQs
Yet another simple, nearly zero dependency, structural log compliance logger implementation.
We found that @guiiai/logg demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.