@crasman/cloud-logger
v1.1.2
Published
```sh $ npm i @crasman/cloud-logger ```
Downloads
1
Keywords
Readme
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 staffalert()
- Requires immediate attention. Notify staff who can fix the problemcritical()
- Indicates failure in a primary system. Fix critical problems before alerterror()
- Failure, does not require immediate attention. Notify developers or adminswarning()
- Indicates a potential error which may escalate if not fixed. Notify developersnotice()
- Indicates an unusual event, which is not an error. No immediate action requiredinfo()
- Normal operational messages. No action requireddebug()
- Debugging traces.
Developing/publishing
- Before pushing changes to
main
, remember tonpm run build
first. - Please use conventional commits:
feat:
New feature for usersfix:
Fix a bug for usersdocs:
Changes to documentationstyle:
Changes to code formattingrefactor:
Refactoring production codetest:
Adding or refactoring testschore:
Updating build automation etc.BREAKING CHANGE
New major version