🚀 Socket Launch Week 🚀 Day 3: Socket Acquires Coana.Learn More
Socket
Sign inDemoInstall
Socket

axios-nice-log

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-nice-log

Axios interceptor logger for requests query parameters

0.1.10
latest
Source
npm
Version published
Maintainers
1
Created
Source

axios-nice-log

Axios interceptor logger for requests query parameters for humans 😜

  • many options customizable
  • set global defaults
  • styles by chalk
  • lightweight ~2kb

Setup

npm i axios-nice-log

Usage

basic

import axios from 'axios'
import axiosNiceLog from 'axios-nice-log'

axios.interceptors.request.use(axiosNiceLog)

local option

import axios from 'axios'
import { axiosNiceLog, setAxiosNiceLog } from 'axios-nice-log'

// global options
setAxiosNiceLog({
  prefix: 'my',
})

// local options
axios.interceptors.request.use((config) =>
  axiosNiceLog(config, {
    prefix: 'custom',
  })
)

Api

Options

OptionTypeDefaultdescription
prefixstring"axios"Line prefix
stylesobjectstyles defaulttemplate parts styles
templatestring"%prefix %time %method %url%params"line template parts available
(%prefix %time %method %url %params)
templatesobjecttemplates defaulttemplate parts value
%s - value replaced
loggercallbackconsole.loglogger function

styles default

{
	prefix: "green",
	time: "reset",
	method: "yellow",
	url: "cyan",
	params: "reset",
	separator: "yellow",
	delimiter: "gray",
}

templates default

{
    prefix: "[%s]",
    time: "%s",
    method: "%s",
    url: "%s",
    params: "%s",
    separator: "?",
    delimiter: "=",
  }

Keywords

log

FAQs

Package last updated on 01 Mar 2021

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