gkatsanos posted a new question
consola โข
How do I set my reported to be the provided JSONreporter? I followed the example in the Readme but I was under the impression the reported should be passed as a configuration? Do I have to create a new instance of consola to use JSONReporter?
And last but not least, does this actually differ from just logging `console.log(JSON.stringify({message: 'error', stack: 'something'});
develohpanda posted a new feature request
consola โข
Currently, calling the trace/debug/error/etc methods prints a timestamp to console, however it is not needed and adds extra clutter to my use case. I would like for hideTimestamp
to be an option on each reporter, which can be defaulted to false (to show the timestamp by default).
Current:
Updated:
Take an additional option hideTimestamp
on the FancyReporter
, for example, that is defaulted to false, and conditionally sends date
to this.filterAndJoin
at https://github.com/nuxt-contrib/consola/blob/2d2115f03e37a98d97a3a1e68ec111b66e1abdd9/src/reporters/fancy.js#L72
JanusSpark posted a new feature request
consola โข
In my object I do not want to log something on production so I use cosola.debug
And I can set logLevel when I develop the project on node side easy with node env
But I can't do the same thing in browser
And I do not want to create the consola bymyself on the browser side
Can consola support some easy way to do that just like the 'debug' library?
It must be a little change
irina05966 posted a new question
consola โข
Why are tags always converted to lowercase?
regevbr posted a new feature request
consola โข
It is sometimes required to have a more fine grain control over log level per reporter.
For instance, let's say we want the stdout reporter to only show info log lever, but at the same time write trace log level to a file using the json reporter.
We need to enable each reporter to have a log level override and when logging occurs, only operate on the relevant loggers
hoiheart posted a new question
consola โข
I would like to change output from Nuxt.js to json log format.
Is there a way?
regevbr posted a new bug report
consola โข
import { Consola, FancyReporter } from 'consola';
will produce an error as there is no exported member FancyReporter
to have proper detentions for the entire library
typescript error
AlexXanderGrib posted a new question
consola โข
The code:
const consola = require('consola')
consola. // *CTRL+Space*
Autocomlete |
---|
BrowserReporter |
Consola |
default |
Instead of
Autocoplete |
---|
log |
mock |
mockTypes |
pause |
โฆ |
Please fix the typing
pi0 posted a new question
consola โข
Ref: #80
Fix a typing issue that causes this to throw a typing error on
consola.green
:
// @ts-check
const consola = require('consola')
consola.green('foo')
Workaround:
// globals.d.ts
import { Consola } from 'consola'
declare module 'consola' {
export = new Consola()
}
asasas333 posted a new bug report
consola โข
https://jsfiddle.net/6hj9wd35/
Run a project with latest version
Remove incorrect export, line 98
https://github.com/nuxt/consola/commit/5c22d8cd4624e3bbd7294b9eba09f131ed786332
An export assignment cannot be used in a module with other exported elements.
asasas333 posted a new question
consola โข
ERROR in ./node_modules/consola/types/consola.d.ts(98,1): nuxt:typescript 11:30:28
96 | export default consolaGlobalInstance
97 |
> 98 | export = consolaGlobalInstance
| ^
99 |
โน Version: typescript 3.7.4 nuxt:typescript 11:30:28
โน Time: 15081ms nuxt:typescript 11:30:28
โน Waiting for file changes 11:30:28
โน Memory usage: 638 MB (RSS: 1.23 GB)
Ckeyang posted a new question
consola โข
how to solve this problem
ERROR in D:/web/test-nuxt-ts/nodemodules/consola/types/consola.d.ts
ERROR in D:/web/test-nuxt-ts/nodemodules/consola/types/consola.d.ts(98,1):
98:1 An export assignment cannot be used in a module with other exported elements.
96 | export default consolaGlobalInstance
97 |
98 | export = consolaGlobalInstance
| ^
99 |
FATAL Nuxt build error
AcerFeng posted a new question
consola โข
ERROR in f:/web/explorer/node_modules/consola/types/consola.d.ts
ERROR in f:/web/explorer/node_modules/consola/types/consola.d.ts(98,1):
98:1 An export assignment cannot be used in a module with other exported elements.
96 | export default consolaGlobalInstance
97 |
> 98 | export = consolaGlobalInstance
| ^
99 |
FATAL Nuxt build error 15:42:59
at WebpackBundler.webpackCompile (node_modules\@nuxt\webpack\dist\webpack.js:5326:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ โ Nuxt Fatal Error โ
โ โ
โ Error: Nuxt build error โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] generate: `nuxt generate`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] generate script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
jjelev posted a new question
consola โข
ERROR ERROR in ./node_modules/consola/types/consola.d.ts(98,1): nuxt:typescript 11:30:28
98:1 An export assignment cannot be used in a module with other exported elements.
96 | export default consolaGlobalInstance
97 |
> 98 | export = consolaGlobalInstance
| ^
99 |
โน Version: typescript 3.7.4 nuxt:typescript 11:30:28
โน Time: 15081ms nuxt:typescript 11:30:28
โน Waiting for file changes 11:30:28
โน Memory usage: 638 MB (RSS: 1.23 GB)
baadc0de posted a new bug report
consola โข
https://codesandbox.io/s/gracious-mendel-uw0vh
Functions like setTimeout and clearTimeout are not defined on https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletGlobalScope
Logging with consola uses these functions in order to throttle logging. It should be possible to disable the throttling or have consola disable throttling if these functions are not available.
Creating a worklet.js file with the following code:
console.log({setTimeout: typeof setTimeout, clearTimeout: typeof clearTimeout})
And another file, index.js with the following:
new AudioContext().audioWorklet.addModule("/worklet.js")
Outputs
{setTimeout: "undefined", clearTimeout: "undefined"}
Consola to log without a crash
Consola code crashes
krzkaczor posted a new bug report
consola โข
https://repl.it/repls/RealDarkredOolanguage
Create deeply (4 levels) nested object and try to log it.
Whole object gets logged in the console.
Object is collapsed and part of it becomes simply [Object] hiding important info.
This could be a configurable behaviour but I strongly belive that by default everything should be visible.
bat79a posted a new bug report
consola โข
https://jsfiddle.net/boilerplate/vue
Hello.
I have installed consola in my project and when I click on a nuxt-link who must display a log via Middleware I have an error : consola.info is not a function
If I refresh the page with my browser the log works well.
PS : an other project with nuxt 2.5.0 and consola 2.5.7 was working well
const consola = require('consola')
export default function (context) {
consola.info('--> Info | request ' + context.route.fullPath + ' launched')
}
export default {
...
router: {
// Run the middleware/log-router.js on every page
middleware: 'log-router'
}
}
Log a message
Blank page with error.
Page :
consola.info is not a function
An error occurred while rendering the page. Check developer tools console for details.
Console :
vendors.app.js:11254 error TypeError: consola.info is not a function
at app.js:3989
at promisify (app.js:3422)
at middlewareSeries (app.js:3401)
at Vue.callMiddleware (app.js:943)
at Vue._callee4$ (app.js:1069)
at tryCatch (commons.app.js:6116)
at Generator.invoke as _invoke
at Generator.prototype.<computed> as next
at asyncGeneratorStep (commons.app.js:31)
at _next (commons.app.js:53)
log @ vendors.app.js:11254
_log @ vendors.app.js:11166
logFn @ vendors.app.js:11160
logFn @ vendors.app.js:11084
push../.nuxt/client.js.vueWEBPACKIMPORTEDMODULE18.default.config.errorHandler @ app.js:680
globalHandleError @ app.js:3101
_callee4$ @ app.js:1319
tryCatch @ commons.app.js:6116
invoke @ commons.app.js:6342
prototype.<computed> @ commons.app.js:6168
asyncGeneratorStep @ commons.app.js:31
_next @ commons.app.js:53
Promise.then (async)
asyncGeneratorStep @ commons.app.js:41
_next @ commons.app.js:53
(anonymous) @ commons.app.js:60
(anonymous) @ commons.app.js:49
_render @ app.js:1342
render @ app.js:947
iterator @ commons.app.js:10678
step @ commons.app.js:10452
(anonymous) @ commons.app.js:10453
(anonymous) @ commons.app.js:10699
_callee3$ @ app.js:805
tryCatch @ commons.app.js:6116
invoke @ commons.app.js:6342
prototype.<computed> @ commons.app.js:6168
asyncGeneratorStep @ commons.app.js:31
_next @ commons.app.js:53
(anonymous) @ commons.app.js:60
(anonymous) @ commons.app.js:49
loadAsyncComponents @ app.js:842
loadAsyncComponents @ app.js:736
iterator @ commons.app.js:10678
step @ commons.app.js:10452
step @ commons.app.js:10456
runQueue @ commons.app.js:10460
confirmTransition @ commons.app.js:10707
transitionTo @ commons.app.js:10609
push @ commons.app.js:10919
push @ commons.app.js:11300
handler @ commons.app.js:9174
invokeWithErrorHandling @ commons.app.js:13255
invoker @ commons.app.js:13580
original.wrapper @ commons.app.js:18303
Show 14 more frames
pimlie posted a new question
consola โข
The repeated X times
is only triggered with a trailing consola call. If you dont have a trailing consola call the spam message doesnt get printed.
See https://jsfiddle.net/6pvqxy1k/1/ for an example, without the END call the (repeated 4 times)
message will never be printed
phamhoaithuong posted a new question
consola โข
import consola from 'consola'
const logger = consola.create({
// level: 4,
reporters:
new consola.JSONReporter()
,
defaults: {
additionalColor: 'white'
}
})
Error TS2339 (TS) Property 'JSONReporter' does not exist on type 'Consola'.
Error TS2322 (TS) Type '{ additionalColor: string; }' is not assignable to type 'ConsolaLogObject'.
Object literal may only specify known properties, and 'additionalColor' does not exist in type 'ConsolaLogObject'.
i'm using code in document, but it have error. i don't nkow how to fix it. pls help me, thanks you very much.
mathieutu posted a new bug report
consola โข
https://codesandbox.io/embed/fervent-pine-su2ty
Hi folks,
Consola is not handling the native string substitutions of console.
https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions
This leads to issues when when using wrapConsole
method in code bases where you don't control logs.
Example: there is a problem with all the react errors.
Here an example before/after the wrap:
- Warning: Received `true` for a non-boolean attribute `secondary`.
+ Warning: Received `%s` for a non-boolean attribute `%s`.
- If you want to write it to the DOM, pass a string instead: secondary="true" or secondary={value.toString()}.
+ If you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.%s true secondary secondary true secondary
in h1 (created by App)
in div (created by App)
in App
For me, consola should have the same api than console, to be able to replace it properly.
How can we handle that?
Thanks for your work,
Matt'.
Consola should have at least the same api and features than console.
Features from console are missing in consola (browser and node).