Allow configuration of colors for each level #90

Closed
vjpr opened this Issue Aug 18, 2012 · 6 comments

Comments

Projects
4 participants
@vjpr

vjpr commented Aug 18, 2012

  1. The config should allow levels to be associated with a color.
  2. These colors should then been accessible when creating a custom pattern.

Not sure best way to add colors to patterns though.

@nomiddlename

This comment has been minimized.

Show comment Hide comment
@nomiddlename

nomiddlename Aug 20, 2012

Collaborator

Sounds useful. The first part sounds reasonably easy, and should be part of the config for the console appender since that's the only part of log4js that knows about colours.

Not sure about adding it to pattern layout though if that's what you mean, since that can be used in non-terminal loggers where the colour codes mess things up.

Collaborator

nomiddlename commented Aug 20, 2012

Sounds useful. The first part sounds reasonably easy, and should be part of the config for the console appender since that's the only part of log4js that knows about colours.

Not sure about adding it to pattern layout though if that's what you mean, since that can be used in non-terminal loggers where the colour codes mess things up.

@dignifiedquire

This comment has been minimized.

Show comment Hide comment
@dignifiedquire

dignifiedquire Nov 22, 2012

Contributor

I think it would be very useful to have a color pattern layout where you can use colors in your pattern. This way there is also no mixup when using non terminal loggers.

Contributor

dignifiedquire commented Nov 22, 2012

I think it would be very useful to have a color pattern layout where you can use colors in your pattern. This way there is also no mixup when using non terminal loggers.

dignifiedquire added a commit to dignifiedquire/log4js-node that referenced this issue Dec 2, 2012

[feature] Add color option to pattern layout.
Based on #90 this implements the possibillity to add the color codes
according to the log level via %[ and %].
@vjpr

This comment has been minimized.

Show comment Hide comment
@vjpr

vjpr May 26, 2013

Workaround at the moment for the first part of the question is:

level = ->
  args = level.caller.arguments
  args[0].level.levelStr.toLowerCase()

log4js.configure appenders: [{pattern: '%[%x{level}%]', tokens: level: level}]

vjpr commented May 26, 2013

Workaround at the moment for the first part of the question is:

level = ->
  args = level.caller.arguments
  args[0].level.levelStr.toLowerCase()

log4js.configure appenders: [{pattern: '%[%x{level}%]', tokens: level: level}]

@nomiddlename

This comment has been minimized.

Show comment Hide comment
@nomiddlename

nomiddlename Mar 27, 2017

Collaborator

Duplicate of #254 - fix for that should fix this one.

Collaborator

nomiddlename commented Mar 27, 2017

Duplicate of #254 - fix for that should fix this one.

@nomiddlename nomiddlename added this to the 2.x milestone Mar 27, 2017

@nomiddlename nomiddlename added this to TODO in Version 2.x Mar 27, 2017

@stanleyxu2005

This comment has been minimized.

Show comment Hide comment
@stanleyxu2005

stanleyxu2005 Apr 15, 2017

Great to find this issue report. Please consider provide individual colors for log levels and individual colors for categories.

Great to find this issue report. Please consider provide individual colors for log levels and individual colors for categories.

@nomiddlename nomiddlename moved this from TODO to In progress in Version 2.x Jul 2, 2017

@nomiddlename nomiddlename moved this from In progress to Done in Version 2.x Jul 2, 2017

@nomiddlename nomiddlename moved this from In progress to Done in Version 2.x Jul 8, 2017

@nomiddlename

This comment has been minimized.

Show comment Hide comment
@nomiddlename

nomiddlename Jul 8, 2017

Collaborator

Released in version 2.0.0

Collaborator

nomiddlename commented Jul 8, 2017

Released in version 2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment