New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

safetrack-log

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

safetrack-log

Stores the logs of the requests and responses to the APIs

  • 0.2.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

safetrack-log 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-log

Usage

Project name

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

Configura conexión

  1. Define environment variables
#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
  1. Add env, mofile file {root-project}/deploy.yaml
    ...
    spec:
      containers:
      - name: safetrack-business-instance-qs
        image: {{image}}
        env:
        ...
        - 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
  1. Modify file {root-project}/src/database/connection.ts
import { getConnection, Connection, createConnections } from 'typeorm';
import config from '@ormconfig';
import { getConnectionLog } from 'safetrack-log';

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();
  },
...

Middleware

  1. Use middleware LoggerMiddlware, modify file {root-project}/src/middlewares/index.ts
...
import { LoggerMiddleware } from 'safetrack-log';

export const middlewares = [
  ...
  LoggerMiddleware
];

Keywords

FAQs

Package last updated on 29 Jun 2022

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