You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which as one drawback is that the later .wrapAll() might not always expected, as if the user wants to completely disable the wrapper by calling .restoreAll() at the server start; But the later .wrapAll() might turn it back unexpectly.
Currently we are using .restoreAll() and .wrapAll() to workaround that in Nuxt:
I was not aware of this. can you share the context of why it was needed? (note the v4 plan: #335, right tags will be removed and partially moved left)
const isConsoleWrapped = this.isConsoleWrapped
This is going to be little more complicated. There is no guarantee of having same consola instance (dependency, runtime module (loc, cjs|esm) or even instance). if we want to do it, it needs global state.
Consola's interop adds timestamp or other format changes to the log, which sometimes might break the layout when it intercepts the log from other tools. For example: nuxt/framework#9761
Meanwhile I found that sometimes the log being eaten by consola with server/api for debugging, I am not yet sure why but unwrap the logger fixes it.
it needs global state.
Yeah, I was more like putting a pesudo code to show the idea. I guess we need to check the existence of console.__log and so to determine if it's wrapped?
Wrapping is because of the right tags (timestamp) which won’t happen in v4.
If you could somehow reproduce condition of logs not being shown, please feel free to open new issue with reproduction 🙏 (note: unenv stubs consola in production with console)
In the meantime i rather to first work on v4 to see if the workaround could be avoided to not temporarily disabling wrapper in certain conditions.
Describe the feature
I'd like to introduce a
consola.runWithoutWrappers(() => {...})
function for temporary escape the wrapper to print raw logs.Currently we are using
.restoreAll()
and.wrapAll()
to workaround that in Nuxt:Which as one drawback is that the later
.wrapAll()
might not always expected, as if the user wants to completely disable the wrapper by calling.restoreAll()
at the server start; But the later.wrapAll()
might turn it back unexpectly.Thus I am thinking to have a
to replace that, which either have a flag to bypass, or only restore if the the console has been wrapped.
The pesudo code I imagine might be:
Additional information
The text was updated successfully, but these errors were encountered: