question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `Write-AzFuncLog` cmdlet to the helper module to allow writing Azure Function user logs in an explicit way.

See original GitHub issue

This 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:open
  • Created 5 years ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
joeyaiellocommented, Mar 13, 2019

Per our discussion, we should talk to the Functions team about how critical is used in another languages.

/cc @asavaritayal @fabiocav

1reaction
daxian-dbwcommented, Mar 12, 2019

I don’t think it’s really… critical… personally though. Hence the request for feedback.

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 a critical 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, for Write-Error, Write-Information, Write-Debug and Write-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.

Do you bombard someone with logs that can’t really be filtered like any other Function App?

Haven’t heard a user complaint yet, but we don’t have much usage today anyways.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found