Closed caarlos0 closed 8 months ago
The default logger will try to query background et al on startup, which might conflict with other libs trying to query it too.
It's easily reproducible with some of our tools that use the log package, e.g., VHS:
faketty vhs --help
It slows down the program quite a bit, and print some ansi escape sequences as well.
This patch changes it so it only inits the default logger when/if the default logger is used.
Per my testing, it seems to fix the original issue.
PS: this is not a faketty-only thing, it's producible if you create a PTY (with creak/pty for example) and run the same command - it's how I initially noticed the issue.
faketty
The default logger will try to query background et al on startup, which might conflict with other libs trying to query it too.
It's easily reproducible with some of our tools that use the log package, e.g., VHS:
It slows down the program quite a bit, and print some ansi escape sequences as well.
This patch changes it so it only inits the default logger when/if the default logger is used.
Per my testing, it seems to fix the original issue.