npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@aurora-is-near/gcp-logger

v1.0.3

Published

A logger for Node that integrates with Google Cloud Platform

Readme

GCP Logger

A logger for Node that integrates with Google Cloud Platform.

This repository enforces semantic commit messages. For more details and examples see the Conventional Commits Specification.

Installation

yarn add @aurora-is-near/gcp-logger

Usage

import { createLogger } from 'aurora-is-near/gcp-logger';

const logger = createLogger();

logger.debug('Something happened');
logger.info('Something else happened');
logger.warn('Something quite bad happened, but I can recover.');
logger.error('Something really bad happened');
logger.error(new Error('I also accept error objects'));

HTTP requests

To include additional information about an HTTP request you can include a request object when calling createLogger(). This object should be a Node IncomingMessage, or child or an IncomingMessage, such as the request object passed to a Google Cloud Function, for example:

const requestHandler = (req, res) => {
  const logger = createLogger({ req });

  logger.debug('Something happened');
}

To include additional information about the response you can use the set function, as follows:

logger.set('httpRequest', {
  status: 500,
  responseSize: '4200',
});

See HttpRequest for more details.

Context

If you want to set some arbitrary context that should be attached to all subsequent log messages you can do so like this:

logger.set('context', {
  user: {
    name: 'Joe Bloggs',
  },
  auth: {
    authenticated: true,
  },
});

If you want to append to some previously set context you can do so like this:

logger.append('context', {
  user: {
    age: 37,
  },
});

Using the two snippets above as an example, this would result in all subsequent log messages including the data:

{
  "jsonPayload": {
    "user": {
      "name": "Joe Bloggs",
      "age": 37
    },
    "auth": {
      "authenticated": true
    }
  }
}

Note that when appending to the context objects will be merged, primitive values and arrays will be replaced.

Log Levels

A logging function is provided for each of the following levels (shown in ascending order):

  • debug: This is the level for something entirely ordinary going on, like a successful response being sent. These may be quite spammy, with multiple entries presenting overlapping information.
  • info: This also has a neutral connotation, but represents something more rare, like a major state change. It could for example also be used for printing the results of a timed job, or usage statistics.
  • warn: This is for unusual conditions that are recoverable but may cause nuisances, or later a more severe problem. For example, it could be used for optional requests failing, or when an inconsistent but uncritical data state is detected.
  • error: This is for a case where the application fails to do its main job. For example, if a user request could not be served, and this cannot be attributed to a client error.

By default, if NODE_ENV=production then logs at the info level and above will be processed, otherwise all logs will be processed. You can control this more specifically by setting the logLevel when calling createLogger(), for example:

createLogger({ logLevel: 'warn' });

You can also set the log level via the LOG_LEVEL environment variable, which may be useful for enabling debug logs temporarily in a remote environment, for example.