Socket
Socket
Sign inDemoInstall

tal-logging-strategies

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tal-logging-strategies - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

.travis.yml

19

package.json
{
"name": "tal-logging-strategies",
"version": "0.1.0",
"main": "lib/tal-logging-strategies.js",
"version": "0.2.0",
"main": "src/index.js",
"author": "Ross Wilson <ross.wilson@bbc.co.uk>",

@@ -13,16 +13,9 @@ "license": "Apache-2.0",

"jest": "^22.1.4",
"rimraf": "^2.6.2",
"rollup": "^0.55.0",
"standard": "^10.0.3",
"uglify-js": "^3.3.8"
"standard": "^10.0.3"
},
"scripts": {
"lint": "standard src/*.js",
"prebuild": "rimraf lib",
"build": "rollup -c",
"postbuild": "npm run minify",
"pretest": "npm run lint && npm run build",
"test": "jest",
"minify": "uglifyjs lib/tal-logging-strategies.js --compress --mangle --output lib/tal-logging-strategies.min.js"
"lint": "standard",
"pretest": "npm run lint",
"test": "jest"
}
}

@@ -21,3 +21,3 @@ function log () {

export default {
module.exports = {
log: log,

@@ -24,0 +24,0 @@ debug: debug,

@@ -21,3 +21,3 @@ function log () {

export default {
module.exports = {
log: log,

@@ -24,0 +24,0 @@ debug: debug,

@@ -1,16 +0,16 @@

import alert from './alert'
import noop from './noop'
import console from './console'
import jsTestDriver from './jstestdriver'
import onScreen from './onscreen'
import xhr from './xhr'
var alertStrategy = require('./alert')
var noopStrategy = require('./noop')
var consoleStrategy = require('./console')
var jsTestDriverStategy = require('./jstestdriver')
var onScreenStrategy = require('./onscreen')
var xhrStrategy = require('./xhr')
var MAP = {
'antie/devices/logging/alert': alert,
'antie/devices/logging/consumelog': noop,
'antie/devices/logging/saving': noop,
'antie/devices/logging/default': console,
'antie/devices/logging/jstestdriver': jsTestDriver,
'antie/devices/logging/onscreen': onScreen,
'antie/devices/logging/xhr': xhr
'antie/devices/logging/alert': alertStrategy,
'antie/devices/logging/consumelog': noopStrategy,
'antie/devices/logging/saving': noopStrategy,
'antie/devices/logging/default': consoleStrategy,
'antie/devices/logging/jstestdriver': jsTestDriverStategy,
'antie/devices/logging/onscreen': onScreenStrategy,
'antie/devices/logging/xhr': xhrStrategy
}

@@ -21,6 +21,6 @@

log: strategy.log,
error: noop.error,
warn: noop.warn,
info: noop.info,
debug: noop.debug
error: noopStrategy.error,
warn: noopStrategy.warn,
info: noopStrategy.info,
debug: noopStrategy.debug
}

@@ -49,3 +49,3 @@

default:
funcs.log = noop.log
funcs.log = noopStrategy.log
}

@@ -59,14 +59,14 @@

var strategy = MAP['antie/devices/logging/' + logging.strategy] || console
var strategy = MAP['antie/devices/logging/' + logging.strategy] || consoleStrategy
return filterLoggingMethods(strategy, logging.level)
}
export default {
module.exports = {
getStrategyForConfig: getStrategyForConfig,
alert: alert,
noop: noop,
console: console,
jsTestDriver: jsTestDriver,
onScreen: onScreen,
xhr: xhr
alert: alertStrategy,
noop: noopStrategy,
console: consoleStrategy,
jsTestDriver: jsTestDriverStategy,
onScreen: onScreenStrategy,
xhr: xhrStrategy
}

@@ -23,3 +23,3 @@ /* global jstestdriver */

export default {
module.exports = {
log: log,

@@ -26,0 +26,0 @@ debug: debug,

function noop () {}
export default {
module.exports = {
log: noop,

@@ -5,0 +5,0 @@ debug: noop,

@@ -52,3 +52,3 @@ function getContainer () {

export default {
module.exports = {
log: log,

@@ -55,0 +55,0 @@ debug: debug,

@@ -45,3 +45,3 @@ /* global XMLHttpRequest */

export default {
module.exports = {
log: log,

@@ -48,0 +48,0 @@ debug: debug,

/* eslint-env jest */
const { alert } = require('../lib/tal-logging-strategies')
const { alert } = require('../src')

@@ -5,0 +5,0 @@ test('alert', () => {

/* eslint-env jest */
const { console } = require('../lib/tal-logging-strategies')
const { console } = require('../src')

@@ -5,0 +5,0 @@ test('console', () => {

/* eslint-env jest */
const LoggingStrategies = require('../lib/tal-logging-strategies')
const LoggingStrategies = require('../src')

@@ -65,5 +65,3 @@ const buildConfig = (strategy, level = 'all') => {

describe('log levels', () => {
describe('when set to all', () => {
it('should enable all the log level functions', () => {

@@ -79,7 +77,5 @@ const config = buildConfig('default', 'all')

})
})
describe('when set to debug', () => {
it('should enable all the log level functions', () => {

@@ -95,7 +91,5 @@ const config = buildConfig('default', 'debug')

})
})
describe('when set to info', () => {
it('should enable all the log level functions except debug', () => {

@@ -112,7 +106,5 @@ const config = buildConfig('default', 'info')

})
})
describe('when set to warn', () => {
it('should enable all the log level functions except debug and info', () => {

@@ -129,7 +121,5 @@ const config = buildConfig('default', 'warn')

})
})
describe('when set to error', () => {
it('should enable log and error log functions and disable debug, info, and warn', () => {

@@ -146,7 +136,5 @@ const config = buildConfig('default', 'error')

})
})
describe('when set to an unknown level', () => {
it('should disable all log functions', () => {

@@ -162,6 +150,4 @@ const config = buildConfig('default', 'unknown-level')

})
})
})
})
/* eslint-env jest */
const { jsTestDriver } = require('../lib/tal-logging-strategies')
const { jsTestDriver } = require('../src')

@@ -14,3 +14,3 @@ test('jsTestDriver', () => {

expect(jstestdriver.console.log).toHaveBeenCalledWith('Example')
expect(window.jstestdriver.console.log).toHaveBeenCalledWith('Example')
})
/* eslint-env jest */
const { onScreen } = require('../lib/tal-logging-strategies')
const { onScreen } = require('../src')
describe('onScreen', () => {
const originalCreateElement = document.createElement
beforeEach(() => document.createElement = originalCreateElement)
beforeEach(() => {
document.createElement = originalCreateElement
})

@@ -34,3 +35,2 @@ test('creates a div container with text contents', () => {

})
})
/* eslint-env jest */
const { xhr } = require('../lib/tal-logging-strategies')
const { xhr } = require('../src')
describe('xhr', () => {
test('makes a POST', () => {

@@ -22,3 +21,2 @@ const open = jest.fn()

})
})
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