Skip to content

Commit

Permalink
fix: evaluate this.heading only once
Browse files Browse the repository at this point in the history
Some implementations define this w/ a getter which changes each time
it's accessed

Credit: @Gcaufy #75
  • Loading branch information
wraithgar committed Feb 9, 2022
1 parent 62f1d23 commit 3633d33
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/log.js
Expand Up @@ -292,8 +292,9 @@ log.emitLog = function (m) {
var disp = log.disp[m.level] != null ? log.disp[m.level] : m.level
this.clearProgress()
m.message.split(/\r?\n/).forEach(function (line) {
if (this.heading) {
this.write(this.heading, this.headingStyle)
var heading = this.heading
if (heading) {
this.write(heading, this.headingStyle)
this.write(' ')
}
this.write(disp, log.style[m.level])
Expand Down

0 comments on commit 3633d33

Please sign in to comment.