Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@luckyorange/utilities-cron-logger

Package Overview
Dependencies
Maintainers
8
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luckyorange/utilities-cron-logger

More helpful log messages for cron jobs

npmnpm
Version
1.0.1
Version published
Maintainers
8
Created
Source

LuckyLogger

LuckyLogger is a lightweight logging utility built specifically for cron jobs. It uses Google Cloud Logging.

Features

  • Simple setup with minimal configuration
  • Automatically formats logs with proper severity levels
  • Filters logs based on a minimum log level
  • Adds Kubernetes pod and container metadata automatically

Installation

npm install @luckyorange/utilities-cron-logger

Usage

  • Import and initialize the logger:
const LuckyLogger = require('@luckyorange/utilities-cron-logger')

// Initialize with the name of your cron job
const logger = new LuckyLogger('session-count-check')
  • Log messages:
logger.info('Starting session count check')
logger.debug('Session count details', { sessionCount: 42 })
logger.warn('Session count is lower than expected')
logger.error('Failed to fetch session data')
logger.critical('Session service unreachable')

Constructor

new LuckyLogger(cronName, minLogLevel)
ParameterTypeDefaultDescription
cronNamestring(required)Name of the cron job (used for the log name and container name)
minLogLevelstring'INFO'Minimum severity to log (DEBUG, INFO, WARNING, ERROR, CRITICAL)

Example:

const logger = new LuckyLogger('session-count-check', 'WARNING')

(This would log only warnings and errors, not info or debug messages.)

Log Methods

Each method corresponds to a severity level in Google Cloud Logging:

MethodSeverity
logger.debug(message, metadata)DEBUG
logger.info(message, metadata)INFO
logger.warn(message, metadata)WARNING
logger.error(message, metadata)ERROR
logger.critical(message, metadata)CRITICAL
  • message — a string describing the log event
  • metadata(optional) an object with any additional information you want to log

Environment Variables

  • HOSTNAME — (auto-populated in Buddy) used as the pod_name
  • CONTAINER_NAME — (auto-populated in Buddy)

Example

const LuckyLogger = require('@luckyorange/utilities-cron-logger')
const logger = new LuckyLogger('session-count-check')

logger.info('Cron started')

try {
  logger.debug('Fetched session data', { sessions: 500 })
} catch (error) {
  logger.error('Error during cron execution', { error: error.message })
}

License

Internal use only — property of Lucky Orange.

FAQs

Package last updated on 08 Jul 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