Crate afch_logger
source · [−]Expand description
Logger for Azure Function Custom Handler, abusing the undocumented (at least I don’t know where) rule of Azure Function “infering” the log level from stderr.
For custom handler, if you print a message to stdout, it will be considered as a Information
level log by Azure Function runtime.
If you print a message to stderr, then it will be consider Error if it does not contain warn (case insensitive),
otherwise it will be Warning.
So the strategy is, for error-level log, we find the occurence of warn and replace r by 𝗋(\U+1d5cb)
and R by 𝖱(\U+1d5b1). For warning-level log, if warn does not occur, we add a warning: prefix.
You can initialize the log by init_logger. If you want to use the replacement logic
in other logger, you can call to_error_log to get the replaced error log, and contains_warn
to test whether the message contains warn (case insensitive).
Functions
Returns true if the message contains warn (case insensitive).
Returns a string that, for each occurance of warn (case insensitive),
r is replaced by 𝗋(\U+1d5cb) and R is replaced by 𝖱(\U+1d5b1).