Open br0p0p opened 6 years ago
Any update in this feature request?
I'd really like to see this feature in next version
As a workaround, you could add an empty console.log();
after your last interactive log message. It starts a new line and prevents updates to the previous line.
any update?
Any update on this?
Any update on this?
As a workaround inspired from @tomkln comment, here is how I export my logger :
import signale, { DefaultMethods, Signale, SignaleOptions } from 'signale'
export const getLogger = (
scope: string,
options: SignaleOptions = {},
): Signale<DefaultMethods> & { breakInteractiveChain: () => void } =>
Object.assign(new Signale({ scope, ...options }), {
// eslint-disable-next-line no-console
breakInteractiveChain: () => console.log(),
})
export default signale
And here is how I consume it :
const iLogger = getLogger('send-mail', { interactive: true })
iLogger.await('Fetching users')
iLogger.success('Users fetched')
// Prevent subsequent calls to interactive logger to override previous ones
iLogger.breakInteractiveChain()
iLogger.await('Sending mails')
iLogger.success('Mails sent')
If this console.log()
hack finally is the preferred solution, I could make a tiny PR about this.
Is it possible to have multiple interactive loggers that update independently of each other (either separated by scope or
Signale
instance)? It seems that the current behavior is that the most recent call to an interactive logger will overwrite any previous interactive output.Here's an example of what I'm trying and the desired output:
Output: Only displays the "scope 2"/
interactive2
logsDesired output: