Skip to content

How to log properly from a custom handler #17

@Fishrock123

Description

@Fishrock123

Hi, I'm using a custom handler so I write a function in Rust: https://github.com/squamishaccess/squamishaccess-signup-function-rs

My main blocker right now is figuring out how to log properly.
Logging to the stdio only seems to show up in a local (VS Code) log stream, and not in the function monitor panel log stream. Ideally I'd like to make log traces to the "invocations" panel, I'm unsure if that is scraped from file system logs or Application Insights.

Additionally, it doesn't seem to parse JSON logs. Here is an example:

2020-10-23T23:05:47.930 [Trace] Sending invocation id:cae182d4-f137-4a62-bc79-76d9265924e1
2020-10-23T23:05:47.930 [Debug] Forwarding httpTrigger invocation for function: 'Paypal-IPN' invocationId: 'cae182d4-f137-4a62-bc79-76d9265924e1'
2020-10-23T23:05:47.931 [Debug] Sending invocation for function: 'Paypal-IPN' invocationId: 'cae182d4-f137-4a62-bc79-76d9265924e1'
2020-10-23T23:05:47.940 [Information] {"level":30,"time":1603494347939,"msg":"<-- Request received","method":POST,"path":/api/Paypal-IPN}
2020-10-23T23:05:47.946 [Information] {"level":30,"time":1603494347939,"msg":"cae182d4-f137-4a62-bc79-76d9265924e1 PayPal IPN Notification Event received successfully."}

The lines that say ... [Information] {"level":30, ... are from my json logger.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions