🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

saylo

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

saylo

use logger.log instead of console.log and you can mute unmute (turn on or off) console.log calls

latest
Source
npmnpm
Version
0.6.3
Version published
Weekly downloads
202
-24.34%
Maintainers
1
Weekly downloads
 
Created
Source

Saylo

Saylo is a slim logging helper that wraps the standard console and adds timestamped output. It ships a couple of preconfigured loggers and a tiny factory so you can decide—per environment—which levels should print and which ones should stay silent.

Installation

npm install saylo

Quick start

import chattyLogger, { logger, silentLogger, createLogger } from 'saylo';

chattyLogger.log('Everything is enabled by default');
chattyLogger.debug('Debug output includes a timestamp and level tag');

logger.log('Only log/info/warn/error are enabled here (debug is muted)');

silentLogger.log('This will not print');

const LOGGER_LOG = process.env.LOGGER_LOG === '1';
const LOGGER_DEBUG = process.env.LOGGER_DEBUG === '1';
const appLogger = createLogger({ LOGGER_LOG, LOGGER_DEBUG });

appLogger.log('Respects LOGGER_LOG');
appLogger.debug('Respects LOGGER_DEBUG');

Each message is prefixed with a timestamp in the [YYYY-MM-DD HH:mm:ss] [LEVEL] form.

API

createLogger(options?)

createLogger({
  LOGGER_LOG: boolean;   // defaults to true – controls log/info/warn/error
  LOGGER_DEBUG: boolean; // defaults to true – controls debug (and info if you want it chatty)
}) => Logger

Disabled levels simply map to a no-op (() => undefined), so calling them is cheap.

Logger methods

  • log(message, ...meta)
  • debug(message, ...meta)
  • info(message, ...meta)
  • warn(message, ...meta)
  • error(message, ...meta)

All methods mirror console.* semantics: they accept any extra arguments and pass them straight through to the console.

Built-in instances

  • chattyLogger (default export) – log, debug, info, warn, error all enabled.
  • loggerlog/info/warn/error enabled, debug muted.
  • silentLogger – everything muted.

Because the factory is tiny you can create as many bespoke loggers as you like, with whatever combination of flags or wrapping logic you need.

Tips

  • Pipe environment variables (LOGGER_LOG, LOGGER_DEBUG) into createLogger if you want to control output without touching call sites.
  • Timestamp helpers live in src/funcs.ts; swap them if you prefer different formatting.
  • There’s no buffering or transport layer—if you need to wire the logger into another system, just wrap the functions returned by createLogger.

License

MIT

Keywords

log

FAQs

Package last updated on 24 Sep 2025

Did you know?

Socket

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.

Install

Related posts