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
I used ulog in a AMD environment with an high order channel which override the output channel if config highorder_log level get reached. ulog is a really nice project for such extending stuff. 💪
Would be nice to have some hints in the documentation. So i rewrote the channel an output part cause the channel configuration is part of channel and not the output. Output doesn't get configured at all 😉
Hope this helps.
Channels
In ulog, logging is always "sent" to exactly one channel. The channel get selected by the configuration. It can also be selected by extending ulog with a mod. (see Custom channel selection )
A channel has one or more configurable outputs that can optionally apply formatting to the message.
By default, two channels exist:
output, for messages of loggers that are in debug mode, or that are at an enabled level
drain, for those messages that are filtered away.
Channel selection
By having a separate channel for the drain, there is the opportunity to use another output than noop(link). So you can configure where discarded messages are going.
For example: send all logging records to a database and filter it later, when it get display for example (see output)
By default all log methods on a logger are associated with one of two channels, output and drain. When the logger is created, each log method is sent either to the output channel, or to the drain channel, based on the current log level for that logger and whether that logger is in debug mode.
To configure the drain / output channel selection the following log config can be used:
If the default behavior is not enough the channel selection in ulog can easily be extended like followed:
ulog.use({after: function(logger){for(varlevelinthis.levels){varchannel=logger.enabledFor(level) ? 'output': 'drain';// calculate new channellogger[level]=logger.channels[channel].fns[level];}},});
Output configuration
The channel output, where messages are going, is completely configurable at runtime.
To configure the outputs for a channel, use the log_ config option. The default channels config options are:
To configure the output for a channel, we assign the name of the output to use to the relevant loggers:
log_output=console
This setting can include expressions to target individual loggers, just like the debug and log settings:
log_output=console;noisy-lib:*=noop
The value part is actually a kurly format string. The same syntax can be used here as for configuring formatting.
If more than one output is specified, a multiplex function will be inserted that dispatches the logging to all specified outputs.
@Messj1 Wow another great issue! Thanks! You really invested time in this. That is so great. Thank you.
May I ask have you ever contributed to an Open Source project before? Would you like to give it a shot?
I can learn you how to make a pull request and how to contribute your changes to this project. Let me know if this is something you would like to try.
Hi
I used
ulog
in a AMD environment with an high order channel which override the output channel if confighighorder_log
level get reached.ulog
is a really nice project for such extending stuff. 💪Would be nice to have some hints in the documentation. So i rewrote the channel an output part cause the channel configuration is part of channel and not the output. Output doesn't get configured at all 😉
Hope this helps.
Channels
In
ulog
, logging is always "sent" to exactly one channel. The channel get selected by the configuration. It can also be selected by extendingulog
with a mod. (see Custom channel selection )A channel has one or more configurable outputs that can optionally apply formatting to the message.
By default, two channels exist:
output
, for messages of loggers that are in debug mode, or that are at an enabled leveldrain
, for those messages that are filtered away.Channel selection
By having a separate channel for the drain, there is the opportunity to use another output than noop(link). So you can configure where discarded messages are going.
For example: send all logging records to a database and filter it later, when it get display for example (see output)
By default all log methods on a logger are associated with one of two channels,
output
anddrain
. When the logger is created, each log method is sent either to the output channel, or to the drain channel, based on the current log level for that logger and whether that logger is in debug mode.To configure the
drain
/output
channel selection the followinglog
config can be used:Custom channel selection
If the default behavior is not enough the channel selection in
ulog
can easily be extended like followed:Output configuration
The channel output, where messages are going, is completely configurable at runtime.
To configure the outputs for a channel, use the log_ config option. The default channels config options are:
log_output
, defaults toconsole
log_drain
, defaults tonoop
To configure the output for a channel, we assign the name of the output to use to the relevant loggers:
This setting can include expressions to target individual loggers, just like the debug and log settings:
The value part is actually a kurly format string. The same syntax can be used here as for configuring formatting.
If more than one output is specified, a multiplex function will be inserted that dispatches the logging to all specified outputs.
Syntax:
Hint: The first match get used. Except the default logger_name (*)
Outputs
Outputs are used in channels to peform the actual task and "log" the data.
By default, the following outputs are included:
Output
console
...
Output
noop
...
The text was updated successfully, but these errors were encountered: