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

@magic/log

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@magic/log - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

6

package.json
{
"name": "@magic/log",
"version": "0.0.1",
"version": "0.0.2",
"description": "enhanced console.log",

@@ -24,6 +24,6 @@ "main": "src/index.js",

"devDependencies": {
"@magic/test": "github:magic/test"
"@magic/test": "0.0.2"
},
"dependencies": {
"@magic/types": "0.0.1"
"@magic/types": "0.0.2"
},

@@ -30,0 +30,0 @@ "files": [

@@ -8,7 +8,17 @@ const is = require('@magic/types')

log.resetLevel = () => (process.env.NODE_ENV === 'production' ? 1 : 0)
log.resetLevel = (env = process.env.NODE_ENV) => {
if (env === 'production') {
log.level = 1
} else {
log.level = 0
}
return log.level
}
log.getLevel = () => (is.number(log.level) ? log.level : log.resetLevel())
log.setLevel = lvl => {
log.setLevel = (lvl, env = process.env.NODE_ENV) => {
if (is.undefinedOrNull(lvl)) {
return log.resetLevel()
}
if (is.string(lvl)) {

@@ -18,8 +28,15 @@ lvl = log.levels.indexOf(lvl)

if (!is.number(lvl)) {
lvl = process.env.NODE_ENV === 'production' ? 1 : 0
if (!is.number(lvl) || lvl < 0) {
if (env === 'production') {
lvl = 1
} else {
lvl = 0
}
}
log.level = Math.min(log.levels.length - 1, Math.max(0, lvl))
if (lvl > log.levels.length - 1) {
lvl = log.levels.length - 1
}
log.level = lvl
return log.level

@@ -68,7 +85,6 @@ }

log.time = (a) => {
log.time = a => {
if (log.getLevel() > 1) {
return false
}
console.time(a)

@@ -78,3 +94,3 @@ return true

log.timeEnd = (a) => {
log.timeEnd = a => {
if (log.getLevel() > 1) {

@@ -81,0 +97,0 @@ return false

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