C# Class JSNLog.Infrastructure.LevelUtils

Afficher le fichier Open project: mperdeck/jsnlog

Méthodes publiques

Méthode Description
HighestLevel ( ) : Level

Returns the highest level as given in Level enum.

IntToLevel ( int i ) : Level

Converts a number to a level. Each level is associated with a value. If the number is equal to or lower than a level, but higher than the previous level, than that level is used. So if: TRACE = 1000, DEBUG = 2000, INFO = 3000, WARN = 4000, ERROR = 5000, FATAL = 6000 And the number is: 2500, than this method returns INFO. If the number is greater than FATAL (highest level), than FATAL is returned. If the number is lower than TRACE, than TRACE is returned. This method assumes that the Level enum is sorted by value!

LevelNumber ( string level ) : int

Determines the numeric value of a level. If level is a number, returns the number. If level is a predefined level name, returns number corresponding to that level. Otherwise throws exception.

NamedLevels ( ) : string

Returns a string with all named levels, separated by | This is used by the web site project.

ParseLevel ( string levelString ) : Level?

Parses a string with the name or value of a level.

PredefinedName ( string level ) : string

Returns the friendly name of the given level if possible. If level is a number matching one of the predefined levels, that level's name is returned. Otherwise, level is returned.

ValidateLevel ( string level ) : void

Throws exception if level is not a valid level.

Method Details

HighestLevel() public static méthode

Returns the highest level as given in Level enum.
public static HighestLevel ( ) : Level
Résultat Level

IntToLevel() public static méthode

Converts a number to a level. Each level is associated with a value. If the number is equal to or lower than a level, but higher than the previous level, than that level is used. So if: TRACE = 1000, DEBUG = 2000, INFO = 3000, WARN = 4000, ERROR = 5000, FATAL = 6000 And the number is: 2500, than this method returns INFO. If the number is greater than FATAL (highest level), than FATAL is returned. If the number is lower than TRACE, than TRACE is returned. This method assumes that the Level enum is sorted by value!
public static IntToLevel ( int i ) : Level
i int
Résultat Level

LevelNumber() public static méthode

Determines the numeric value of a level. If level is a number, returns the number. If level is a predefined level name, returns number corresponding to that level. Otherwise throws exception.
public static LevelNumber ( string level ) : int
level string
Résultat int

NamedLevels() public static méthode

Returns a string with all named levels, separated by | This is used by the web site project.
public static NamedLevels ( ) : string
Résultat string

ParseLevel() public static méthode

Parses a string with the name or value of a level.
public static ParseLevel ( string levelString ) : Level?
levelString string
Résultat Level?

PredefinedName() public static méthode

Returns the friendly name of the given level if possible. If level is a number matching one of the predefined levels, that level's name is returned. Otherwise, level is returned.
public static PredefinedName ( string level ) : string
level string
Résultat string

ValidateLevel() public static méthode

Throws exception if level is not a valid level.
public static ValidateLevel ( string level ) : void
level string
Résultat void