Crate session_log

source ·

Modules§

Macros§

Structs§

  • Configuration for the logger.
  • The Global logger will share the same logger instance across the entire program that has the same name. This is useful when the logger is configured once and used in multiple places. The logger will be created with default configurations if it does not exist.
  • Location type is used to represent the location where the logging is happened. It cannot be created outside of the library.
  • Logger is the base type that actually handle the loggings
  • A session is a temporary logger that will print immediately but only write when dropped. All the logs during the session will be grouped together and write once. It’s useful when you want to log a series of messages such as one session of a request. The session is panic-safe, which means it will write all the logs when panic.
  • Source type is used to store the absolute path of the source logger. A source must be started with logger, and can have any number layers of session. This type cannot be constructed outside of the library.
  • Time type is used to represent the current time when the logging is happened. It cannot be created outside of the library.

Enums§

  • Context type is presenting one line of logging with their corresponding information. It has three variants: Header, Footer, and Message. Header and Footer are used to represent the start and end of the logging session, while Message is used to represent the actual logging message. This type cannot be created outside of the library.
  • Level enum is representing the level of message & which level the logger accepts. There are 7 that are available: Debug, Verbose, Info, Warning, Critical, Error, and Fatal.

Traits§

  • Loggable trait is used to define the common behavior for the type that can be used as a logger.
  • Output trait is used to define a common interface for all types that can both be written to a file and printed to the console. This is the basic traits for each components of the log.