Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google-cloud/logging-winston

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/logging-winston

Cloud Logging transport for Winston

  • 6.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @google-cloud/logging-winston?

@google-cloud/logging-winston is a logging transport for the Winston logging library that allows you to easily send logs to Google Cloud Logging. It integrates seamlessly with Winston, enabling you to leverage Google Cloud's powerful logging infrastructure for your Node.js applications.

What are @google-cloud/logging-winston's main functionalities?

Basic Logging

This feature allows you to set up basic logging with Winston and send logs to Google Cloud Logging. The code sample demonstrates how to create a logger with both console and Google Cloud Logging transports.

const winston = require('winston');
const { LoggingWinston } = require('@google-cloud/logging-winston');

const logger = winston.createLogger({
  level: 'info',
  transports: [
    new winston.transports.Console(),
    new LoggingWinston()
  ]
});

logger.info('Hello, world!');

Structured Logging

This feature allows you to send structured logs to Google Cloud Logging. The code sample shows how to log a message with additional metadata, which can be useful for more detailed log analysis.

const winston = require('winston');
const { LoggingWinston } = require('@google-cloud/logging-winston');

const logger = winston.createLogger({
  level: 'info',
  transports: [
    new winston.transports.Console(),
    new LoggingWinston()
  ]
});

logger.info('User logged in', { userId: '1234', method: 'OAuth' });

Error Logging

This feature allows you to log errors to Google Cloud Logging. The code sample demonstrates how to catch an error and log it using the logger.

const winston = require('winston');
const { LoggingWinston } = require('@google-cloud/logging-winston');

const logger = winston.createLogger({
  level: 'error',
  transports: [
    new winston.transports.Console(),
    new LoggingWinston()
  ]
});

try {
  throw new Error('Something went wrong!');
} catch (err) {
  logger.error('Error occurred', err);
}

Other packages similar to @google-cloud/logging-winston

Keywords

FAQs

Package last updated on 10 Aug 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc