Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

acho-trace

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acho-trace

Automatically logs traces

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

acho-trace


acho-trace

Last version Build Status Dependency status Dev Dependencies Status NPM Status Donate

It Envolves async/sync methods for automatically logs traces. Inspired in Apex log.

Install

$ npm install acho-trace --save

Usage

First load the plugin:

const Acho = require('acho')
Acho = require('acho-trace')(Acho)

Now when you call Acho for create a new instance, the new instance will have .trace and .traceSync methods for envolve functions and create traces.

For see it in action check examples.

API

The API provides to endpoints:

  • acho#trace
  • acho#traceSync

both methods follow the same interface:

'use strict'

var Acho = require('acho')
Acho = require('acho-trace')(Acho)

var acho = Acho()
var fn = createFnAsync()
var wrapFnOne = acho.trace(fn, {

  /*
    OPTIONAL. [default=false]
    It expresses if you are wrapping a sync function.
    Also you can use `acho#traceSync` endpoint.
  */
  sync: false,

  /*
    OPTIONAL. [default='debug']
    output level under non-error result.
  */
  level: 'debug',

  /*
    OPTIONAL. [default='error']
    output level under error result.
  */
  levelErr: 'error',

  /*
    OPTIONAL. [default='']
    context associated with the message.
  */
  context: '',

  /*
    OPTIONAL.
    Custom print function to create print
    messages under non-error.

    By default it prints the arguments
    passed in the original function.
  */
  trace: function (obj) {
    return ['executed fn with params: %j', obj]
  },

  /*
    OPTIONAL.
    Custom print function to create print
    messages under error.

    By default it prints the arguments
    passed in the original function.
  */
  traceErr: function (err) {
    return ['something bad happens: %s', err.message]
  }
})

License

MIT © Kiko Beats

Keywords

FAQs

Package last updated on 01 May 2016

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