@crasman/cloud-logger
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @crasman/cloud-logger

Weekly Downloads

1

Version

1.1.2

License

UNLICENSED

Unpacked Size

4.59 kB

Total Files

4

Last publish

Collaborators

  • mosesho
  • kimja
  • phcras
  • _crasman
  • mlcras
  • joonava