Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

fastify-frontend-logger

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-frontend-logger

A Fastify plugin for receiving browser logs to a server

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

fastify-frontend-logger

A Fastify plugin for receiving browser logs to a server

Features

  • Very customizable
  • Logger objects like pino
  • Appends "type": "frontend-logger" to every log.

Quickstart

yarn add fastify-frontend-logger
import fastify from 'fastify';
import { frontendLoggerPlugin } from 'fastify-frontend-logger';

const server = fastify();
server.register(frontendLoggerPlugin);

The frontend logger adds a method to your server at /logger. This consumes a default logger object:

[
  {
    "msg": "Hello world",
    "level": 30,
    "time": 1483531681798,
    "ctx": {
      "browser": "Firefox"
    },
    "payload": {
      "users": ["cobraz"]
    }
  }
]

Note: You can change how the logger object is by setting bodySchema in the plugin options.

Options

  • path can be used to change where the logger is served (defaults to /logger).
  • bodySchema can be used to change the validation schema.
  • preHandler can be used to run code before passing to logs (e.g. authentication)
  • loggerOptions the plugin adds a logger child, with this option you can set your own.

FAQs

Package last updated on 15 May 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