Skip to main content

Logger.hasLevel property

Check if the log level was set.

Signature​

get hasLevel(): boolean;

Remarks​

If the logger was created without an explicit log level, the logger is in a preliminary state and all messages will be stored in an internal buffer until the log level is set.

Until the level is set, every message is formatted and stored in the buffer, which has a cost; see the section "Delaying setting the log level" of the User's Guide.

  • changed to an accessor in v5.0.0
  • added as a method in v2.1.0

Example​

if (!log.hasLevel) {
log.level = Logger.recommendedLevel
}

Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.60.1.