ryan-mars / stochastic

TypeScript framework for building event-driven services. Easily go from Event Storming → Code.
MIT License
6 stars 1 forks source link

Change LogLevel enum to be ordered #101

Closed sam-goodwin closed 3 years ago

sam-goodwin commented 3 years ago

We should update the LogLevel enum to be numeric so they are ordered. That way we can do things like if (logLevel > LogLevel.Info).

See https://github.com/stochastic/stochastic/pull/88/files#r664706651

sam-goodwin commented 3 years ago

Should Debug be greater than or less than error. Debug should be the "highest", right?

ryan-mars commented 3 years ago

Should Debug be greater than or less than error. Debug should be the "highest", right?

The pattern I'm most familiar with is from log4j although I'm not sure if we need all these.

Level.ALL

The ALL has the lowest possible rank and is intended to turn on all logging.

Level.DEBUG

The DEBUG Level designates fine-grained informational events that are most useful to debug an application.

Level.ERROR

The ERROR level designates error events that might still allow the application to continue running.

Level.FATAL

The FATAL level designates very severe error events that will presumably lead the application to abort.

Level.INFO

The INFO level designates informational messages that highlight the progress of the application at coarse-grained level.

Level.OFF

The OFF has the highest possible rank and is intended to turn off logging.

Level.TRACE

The TRACE Level designates finer-grained informational events than the DEBUG

Level.WARN

The WARN level designates potentially harmful situations.

ryan-mars commented 3 years ago

Maybe we'd be fine with just ERROR, INFO, DEBUG, in that order. TRACE might be useful as well.

I never could figure out what WARN was for.

sam-goodwin commented 3 years ago

Maybe we'd be fine with just INFO, ERROR, DEBUG, in that order. TRACE might be useful as well.

I never could figure out what WARN was for.

Implemented in https://github.com/stochastic/stochastic/pull/88

Please approve the PR unless there are other changes you want to see.