Log levels

As we discussed earlier, with the log crate, we need to import the following logging macros. We can use the following:

  • trace!
  • debug!
  • info!
  • warn!
  • error!

These are ordered by the importance of the information they print, with trace! being the least important and error! being the most important:

  • trace!: Used to print verbose information about any pivotal activity. It allows web servers to trace any incoming chunk of data.
  • debug!: Used for less verbose messages, such as the incoming server requests. It is useful for debugging.
  • info!: Used for important information such as the runtime or server configuration. It is rarely used in library crates.
  • warn!: Informs the user about non-critical errors, such as if the client has used broken cookies or if the necessary microservice is temporarily unavailable and cached data is used for responses instead.
  • error!: Provides an alert about critical errors. This is used when the database connection is broken.

We imported the necessary macro directly from the log crate.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.96.105