Azure / azure-sdk-for-go

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:
https://docs.microsoft.com/azure/developer/go/
MIT License
1.59k stars 821 forks source link

Expose `github.com/Azure/azure-sdk-for-go/sdk/internal/log` package so that custom policy can print log #22052

Open MartinForReal opened 9 months ago

MartinForReal commented 9 months ago

Feature Request

In current design, custom policy which is out of github.com/Azure/azure-sdk-for-go/sdk module cannot import log package. It is hard to debug policy without any log.

I'm wondering if we could expose this package for custom policy. Thanks!

jhendrixMSFT commented 9 months ago

If you just need access to the Event type it can be found in the azcore/log package.

https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/azcore/log/log.go#L15

github-actions[bot] commented 9 months ago

Hi @MartinForReal. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

MartinForReal commented 9 months ago

I want to invoke log.write function in custom policy to print some info. It would be great if log package can be exposed to public.

jhendrixMSFT commented 9 months ago

Thanks for clarifying.

Can we get more info about your scenario? The SDK's logging facility wasn't meant to be general-purpose, but for SDK authors.

MartinForReal commented 9 months ago

A throttled policy was implemented in cloud provider. https://github.com/kubernetes-sigs/cloud-provider-azure/blob/master/pkg/azclient/policy/ratelimit/flowcontrol/throttle.go And I just want to print some logs. With these log entries, I can confirm that the request was not sent.