
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Laid back debug logging.
npm install snooplogg
DEBUG
(or SNOOPLOGG
) environment variableconst debug = snooplogg('myapp').log;
import log from 'snooplogg';
log.trace('bow'); // writes to stdout/stderr if DEBUG matches + all pipes
log.info('wow')
.warn('wow')
.error('wow');
import snooplogg from 'snooplogg';
const log = snooplogg('myapp');
log.info('bow', 'wow', 'wow'); // writes to stdout/stderr if DEBUG=myapp + all pipes
import snooplogg from 'snooplogg';
const log = snooplogg.stdio('yippy yo');
log.info('bow', 'wow', 'wow'); // writes to stdout/stderr + all pipes
const log = snooplogg.enable('*')('yippy yay');
log.info('bow', 'wow', 'wow'); // writes to stdout/stderr + all pipes
import snooplogg from 'snooplogg';
const log = snooplogg
.pipe(someWritableStream);
log.info('yippy', 'yo');
# macOS and Linux
$ DEBUG=izzle node loggfather.js
# Windows PowerShell
> $Env:DEBUG="izzle" node loggfather.js
# Windows Command Prompt
> set DEBUG=izzle
> node loggfather.js
Note: You may also use the
SNOOPLOGG
environment variable to avoid conflicts with other libraries that use debug
Listen for messages from all SnoopLogg
instances, even from other
dependencies.
import snooplogg, { snoop } from 'snooplogg';
snoop();
const log = snooplogg('bumpin');
log('one');
log
.trace('two')
.debug('three')
.info('and to the four');
log.warn(`It's like this`);
log.error('and like that');
log.fatal('and like this');
import snooplogg, { type } from 'snooplogg';
type('jin', { color: 'cyan' });
type('juice', { color: 'yellow' });
const log = snooplogg();
log.jin('parents ain\'t home');
log.juice('too much drama', true);
snooplogg()
Creates a namespaced logger as well as defines the global namespaced logger.
snooplogg.log(msg)
Outputs a message using the standard console.log()
format syntax.
snooplogg.config(options)
Allows you to set various instance specific options.
colors
- (Array) An array of color names to choose from when auto-selecting a color,
specifically for rendering the namespace.minBrightness
- (Number) The minimum brightness to auto-select a color. Value must be between 0
and 255 as well as less than or equal to the maxBrightness
. Defaults to 0
.maxBrightness
- (Number) The maximum brightness to auto-select a color. Value must be between 0
and 255 as well as greater than or equal to the minBrightness
. Defaults to 255
.theme
- (String) The name of the default theme to use. Defaults to standard
.maxBufferSize
- (Number) The maximum number of log lines to buffer. Used to flush prior messages
to new pipes.Returns the original SnoopLogg
instance.
SnoopLogg allows you to set defaults using environment variables that apply to all SnoopLogg instances.
SNOOPLOGG_COLOR_LIST
- A comma-separated list of supported color names.SNOOPLOGG_DEFAULT_THEME
- Sets the theme
.SNOOPLOGG_MAX_BUFFER_SIZE
- Sets the maxBufferSize
.SNOOPLOGG_MAX_BRIGHTNESS
- Sets the maxBrightness
.SNOOPLOGG_MIN_BRIGHTNESS
- Sets the minBrightness
.(The MIT License)
Copyright (c) 2017 Chris Barber
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Your mind on your logs and your logs on your mind
The npm package snooplogg receives a total of 2,366 weekly downloads. As such, snooplogg popularity was classified as popular.
We found that snooplogg demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.