Socket
Socket
Sign inDemoInstall

karma-log-reporter

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-log-reporter

A simple customized karma log reporter that lets you capture console messages in tests into file.


Version published
Maintainers
1
Weekly downloads
181
decreased by-11.27%

Weekly downloads

Readme

Source

karma-log-reporter

About

This is a customized karma report that captures console log messages into file. It is inspired by karma-json-log-reporter. I created this report because I need a reporter that can log plain text.

Usage

npm install karma-log-reporter --save-dev

Configuration

Simple text log

// karma.conf.js
module.exports = function(config) {
  config.set({
    "logReporter": {
      "outputPath": "test/some/path/", // default name is current directory
      "logFileName": "logfile.log" // default name is logFile_month_day_year_hr:min:sec.log
    },
    "plugins": [
      "karma-log-reporter"
    ],
    "reporters": ["log-reporter"]
  });
};

log with filter_key

A filter_key can be specified in the configuration to only log to file when filter_key is provided in console.log.

To achieve this, provide a filter_key in configuration first:

// karma.conf.js
module.exports = function(config) {
  config.set({
    "logReporter": {
      "outputPath": "test/some/path/",
      "logFileName": "logfile.log",
      "filter_key": "log-filter"
    },

	...
  });
};

Then only this format will be logged into file.

\\ this will be logged.
console.log(JSON.stringify({filter_key: 'log-filter', message: 'this message will be logged to file.'}));

\\ this will not be logged.
console.log('this message will not be logged to file')

Keywords

FAQs

Last updated on 28 Apr 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc