Add `Write-AzFuncLog` cmdlet to the helper module to allow writing Azure Function user logs in an explicit way.
See original GitHub issueThis is a feedback from the tech review within PowerShell team.
Currently PowerShell built-in Write-*
cmdlets are redirected to the Azure Function log in the following mapping:
Write-* cmdlet (the target stream) | Log level |
---|---|
Write-Verbose (verbose stream) | Trace |
Write-Progress (progress stream) | Trace |
Write-Debug (debug stream) | Debug |
Write-Information (information stream) | Information |
Write-Host (information stream) | Information |
Write-Warning (warning stream) | Warning |
Write-Error (error stream) | Error |
Write-Output (output stream) | Information |
The log level Critical
doesn’t have a corresponding mapping, and for Verbose
, Progress
, Host
, and Output
, it’s not obvious for users to tell what log levels they are mapped to.
So the feedback is to provide another cmdlet to allow writing Azure Function user logs in an explicit way.
The proposal is Write-AzFuncLog
, with the following syntax:
Write-AzFuncLog [-Message] <string> [-Level] <string> [<CommonParameters>]
As for the implementation, probably it should just call Write-Information -Tag
internally with the log level as the tag.
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (12 by maintainers)
Top Results From Across the Web
Configure monitoring for Azure Functions
Learn how to connect your function app to Application Insights for monitoring and how to configure data collection.
Read more >PowerShell developer reference for Azure Functions
This article provides details about how you write Azure Functions using ... You can use the logging cmdlets to write to each output...
Read more >Azure Function App Logging - Microsoft Q&A
I am getting lot of logging when I am trying to authenticate with Service Principal and also writing the data to Event Hub...
Read more >Work with Azure Functions Core Tools
Learn how to code and test Azure Functions from the command prompt or terminal on your local computer before you run them on...
Read more >Azure Functions Node.js developer guide
This guide is an introduction to developing Azure Functions using JavaScript or TypeScript. The article assumes that you have already read ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Per our discussion, we should talk to the Functions team about how
critical
is used in another languages./cc @asavaritayal @fabiocav
I think the
critical
concept in logging is determined by the business logic of a Function implementation. Maybe it’s not an error in script running, but the state of something makes acritical
log necessary.For number 2, the way I’m thinking is that, when I’m using
Write-Verbose -Verbose
in my script, I don’t necessarily mean to have my verbose message written to the trace level log. Instead, most of time, I just want to see them displayed to me truly as verbose messages. That’s why I think that proposal also makes sense to me. But, forWrite-Error
,Write-Information
,Write-Debug
andWrite-Warning
, their names match the log level so well that it would be confusing if they don’t really write to the corresponding logs. Hence, like I said, I’m not super sure about it.Haven’t heard a user complaint yet, but we don’t have much usage today anyways.