log top-level property Debug

dynamic log
final

{@category Debug} Accepts a variable number of arguments for logging.

Tag Management:

  • Pushing Tags: If the first argument is a string starting with one or more tags like [Tag1][Tag2], these tags are pushed onto the tag stack. The stack ([Tag1::Tag2]) is prepended to subsequent log messages.
  • Popping Tags: Calling log() with no arguments pops the most recent tag from the tag stack.
  • Temporary Tags: If the first argument is a string like [TempTag] :: message, TempTag is pushed onto the stack only for the duration of this single log call. The stack state is restored afterwards.
  • Tag-Only Calls: Calls like log('[PersistentTag]') will push the tag onto the stack permanently without printing any message.
  • If the first tag in a message is currently already on the top of the tag stack it won't be pushed again.

Output:

  • The current tag stack ([Tag1::Tag2] ) is always prepended to the message.
  • All arguments are converted to strings and joined with spaces.
  • Output is subject to filtering configured via logFilter.

Implementation

final log = VarargsFunction(_log) as dynamic;