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

@seamapi/logger

Package Overview
Dependencies
Maintainers
5
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seamapi/logger

This module should be used instead of console.log, it has the following features:

  • 1.9.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
5
Weekly downloads
 
Created
Source

Seam Typescript Logger

This module should be used instead of console.log, it has the following features:

  • Output for submodules can easily be shown/hidden with DEBUG=module-name (by default, DEBUG=seam-connect)
  • Supports "Context Wrappers" when logging

Usage

You shouldn't directly call this module when you want to log, you should create a lib/logger.ts file for each project, this way you can set up a logger with the correct DEBUG flag ("seam-connect") by default.

import { DatabaseConnection } from "types"
import defaultAxios from "axios"
import { Event } from "types/noiseaware"
import logger from "@seamapi/logger"
import wrappers from "nextjs-middleware-wrappers"

export const getEvents = wrappers(
  logger.withContext("getEvents"),
  async ({ user_token }): Promise<Array<Event>> => {
    logger.addToContext({ user_token })
    const axios = defaultAxios.create({
      baseURL: process.env.NOISEAWARE_PORTAL_BASE_URL,
      headers: {
        Authorization: `Bearer ${user_token}`,
      },
    })
    logger.logAxios(axios)

    const res = await axios.post("/events/list", {
      pageNum: 0,
      perPage: 100,
    })

    logger.debug("Got events", { events: res.data })

    return res.data.data
  }
)

export default getEvents

Output format is controlled by the environment variable SEAM_LOGGER_FORMAT, which can be set to pretty (default, used during development) or json.

FAQs

Package last updated on 26 Apr 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