mentie 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/modules/logging.js +27 -4
- package/package.json +1 -1
package/modules/logging.js
CHANGED
|
@@ -8,7 +8,7 @@ const should_log = levels => {
|
|
|
8
8
|
const loglevel = env.loglevel()
|
|
9
9
|
|
|
10
10
|
// Check if the loglevel matches this call
|
|
11
|
-
const valid_levels = [ 'debug', 'info', 'warn', 'error' ]
|
|
11
|
+
const valid_levels = [ 'insane', 'debug', 'info', 'warn', 'error' ]
|
|
12
12
|
|
|
13
13
|
// Check if the loglevel is valid
|
|
14
14
|
if( !valid_levels.includes( loglevel ) ) console.warn( `Invalid log level: ${ loglevel }` )
|
|
@@ -119,14 +119,37 @@ export function log( ...messages ) {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
122
|
+
* Insanely verbose logs that you should probably never use.
|
|
123
|
+
* Only logs if ?loglevel= or LOG_LEVEL= is set to: 'insane'
|
|
124
|
+
* 🎯 Goal: log extremely verbose messages that you probably don't want to see
|
|
125
|
+
*/
|
|
126
|
+
log.insane = function( ...messages ) {
|
|
127
|
+
|
|
128
|
+
// Check if the loglevel matches this call
|
|
129
|
+
const levels = [ 'insane' ]
|
|
130
|
+
|
|
131
|
+
// Log the messages if the loglevel matches
|
|
132
|
+
if( should_log( levels ) ) {
|
|
133
|
+
|
|
134
|
+
// Annotate the provided messages
|
|
135
|
+
messages = annotate_messages( messages )
|
|
136
|
+
|
|
137
|
+
// Log the messages
|
|
138
|
+
console.log( '🌪️ ', ...messages )
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Very verbose debug logs
|
|
123
146
|
* Only logs if ?loglevel= or LOG_LEVEL= is set to: 'debug'
|
|
124
147
|
* 🎯 Goal: log extremely verbose messages that you probably don't want to see
|
|
125
148
|
*/
|
|
126
149
|
log.debug = function( ...messages ) {
|
|
127
150
|
|
|
128
151
|
// Check if the loglevel matches this call
|
|
129
|
-
const levels = [ 'debug' ]
|
|
152
|
+
const levels = [ 'debug', 'insane' ]
|
|
130
153
|
|
|
131
154
|
// Log the messages if the loglevel matches
|
|
132
155
|
if( should_log( levels ) ) {
|
|
@@ -135,7 +158,7 @@ log.debug = function( ...messages ) {
|
|
|
135
158
|
messages = annotate_messages( messages )
|
|
136
159
|
|
|
137
160
|
// Log the messages
|
|
138
|
-
console.log( '
|
|
161
|
+
console.log( '🐛 ', ...messages )
|
|
139
162
|
|
|
140
163
|
}
|
|
141
164
|
|