1.1.2 • Published 2 years ago

@crasman/cloud-logger v1.1.2

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
2 years ago

Installation

$ npm i @crasman/cloud-logger

Permissions

Writing logs into GCP requires the roles/logging.logWriter role.

Usage

import { CloudLogger } from '@crasman/cloud-logger';

const { logger } = new CloudLogger({ projectId: 'your-gcp-project-id' });

logger.info('Cloud logger initialized.', { hello: 'world' });

Logger methods

All logging methods take a message argument, and optionally any number of metadata arguments.

  • emergency() - Panic condition, affects multiple services. Notify all tech staff
  • alert() - Requires immediate attention. Notify staff who can fix the problem
  • critical() - Indicates failure in a primary system. Fix critical problems before alert
  • error() - Failure, does not require immediate attention. Notify developers or admins
  • warning() - Indicates a potential error which may escalate if not fixed. Notify developers
  • notice() - Indicates an unusual event, which is not an error. No immediate action required
  • info() - Normal operational messages. No action required
  • debug() - Debugging traces.

Developing/publishing

  • Before pushing changes to main, remember to npm run build first.
  • Please use conventional commits:
    • feat: New feature for users
    • fix: Fix a bug for users
    • docs: Changes to documentation
    • style: Changes to code formatting
    • refactor: Refactoring production code
    • test: Adding or refactoring tests
    • chore: Updating build automation etc.
    • BREAKING CHANGE New major version