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 🙏

© 2026 – Pkg Stats / Ryan Hefner

safetrack-logger

v0.0.12

Published

Stores the logs of the requests and responses to the APIs

Downloads

682

Readme

safetrack-logger NPM version NPM monthly downloads NPM total downloads

Stores the logs of the requests and responses to the APIs

requestTime: request time
url: endpoint service
username: username request
roles: user roles
responseStatus: response status (200 | 400 | 500 etc)
verb: method (POST | GET | PUT | DETELE)
requestHeader: request header
requestBody: request body 
responseBody: response body
requestIp: request ip
requestSsoo: user agent

Install

Install with npm:

$ npm i safetrack-logger

Install with yarn:

$ yarn add safetrack-logger

Usage

Project name

  1. Check for package.json, if it exists name is returned

Configura conexión

  1. Define environment variables (also insert into .env.example)
#TYPEORM LOG
TYPEORM_TYPE_LOG = mongodb
TYPEORM_HOST_LOG = localhost
TYPEORM_USERNAME_LOG = safetrack
TYPEORM_PASSWORD_LOG = 
TYPEORM_DATABASE_LOG = safetrack
TYPEORM_PORT_LOG = 27017
TYPEORM_SYNCHRONIZE_LOG = false
TYPEORM_LOGGING_LOG = true
TYPEORM_SSL_LOG = logger_ca.crt

TYPEORM_SSL_LOG is optional, connect with ssl. If you add follow step 4

  1. Add env, mofile file {root-project}/deploy.yaml
    ...
    spec:
      containers:
      - name: safetrack-business-instance-qs
        image: {{image}}
        env:
        ...
        // add next lines
        - name: TYPEORM_TYPE_LOG
          valueFrom:
            secretKeyRef:
              name: safetrack-backend-secret
              key: typeorm_type_log
        - name: TYPEORM_HOST_LOG
          valueFrom:
            secretKeyRef:
              name: safetrack-backend-secret
              key: typeorm_host_log
        - name: TYPEORM_USERNAME_LOG
          valueFrom:
            secretKeyRef:
              name: safetrack-backend-secret
              key: typeorm_username_log
        - name: TYPEORM_PASSWORD_LOG
          valueFrom:
            secretKeyRef:
              name: safetrack-backend-secret
              key: typeorm_password_log
        - name: TYPEORM_DATABASE_LOG
          valueFrom:
            secretKeyRef:
              name: safetrack-backend-secret
              key: typeorm_database_log
        - name: TYPEORM_PORT_LOG
          valueFrom:
            secretKeyRef:
              name: safetrack-backend-secret
              key: typeorm_port_log
        - name: TYPEORM_SYNCHRONIZE_LOG
          valueFrom:
            secretKeyRef:
              name: safetrack-backend-secret
              key: typeorm_synchronize_log
        - name: TYPEORM_LOGGING_LOG
          valueFrom:
            secretKeyRef:
              name: safetrack-backend-secret
              key: typeorm_logging_log
        - name: TYPEORM_SSL_LOG
          valueFrom:
            secretKeyRef:
              name: safetrack-backend-secret
              key: typeorm_ssl_log
  1. Modify file {root-project}/src/database/connection.ts
import { getConnection, Connection, createConnections } from 'typeorm';
import config from '@ormconfig';
import { getConnectionLog } from 'safetrack-logger';

const connection = {
  async create(callback?: (c: Connection[]) => void): Promise<void> {
    try {
      const connection = await createConnections([config]);
      connection.push(await getConnectionLog());
      if (callback) {
        callback(connection);
      }
    } catch (error) {
      throw new Error(`ERROR: Creating test db connection: ${error}`);
    }
  },

  async close(): Promise<void> {
    await getConnection().close();
    await getConnection('log').close();
  },
...
  1. If add TYPEORM_SSL_LOG modify Dockerfile.dev and Dockerfile.prod. Add logger_ca.crt root project
...
# Add next COPY ormconfig* ./
COPY logger_ca* ./
...

Middleware

  1. Use middleware loggerMiddlware, modify file {root-project}/src/app.ts
...
import { loggerMiddleware } from 'safetrack-logger';

// Add befere useExpressServer(app, routingControllersOptions);
app.use(routingControllersOptions.routePrefix, loggerMiddleware([<arrayPaths>]));

// Wrap server with routing-controllers
useExpressServer(app, routingControllersOptions);

arrayPaths is optional, are the paths with sensitive data that you do not want to show in the response and in the request. Example ['instance/:param','business-instance/instance/:param], in this case it will ignore the paths instance/{id} and business-instance/instance/{instanceId}. Use :param where param dynamic.