Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I would like to be able to add logging in the generated Golang code #227

Open
john-isa opened this issue Feb 23, 2022 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@john-isa
Copy link

Purpose

I would like to be able to set up logging in the sysl-generated code so as to:

  • track changes to selected variables (log on variable change; i.e. when the variable is on the left of the '=')
  • track incoming and outgoing http request of a given endpoint name and type (GET, GUT, POST, DELETE, etc.)

Suggested approaches

An Example

import upstream.yaml as UP ~openapi3    ## logs endpoint entry (headers and body) and response (headers and body)
import downstream.yaml as DOWN [~log]   ## logs endpoint entry (headers and body) and response (headers and body)

UP [~validate]: 
    @package="UP"

    /dotheup: [~log] 
        POST:
            DOWN <- POST /do/the/down [~log] 
            | DOWN forwards the request asynchronously and replies immediately

    !type HealthCheckResponse:                ## logs all variables of this type
        Status <: string
        ServiceName <: string
        AppVersion <: string
        
    !type MissingParameter [~error]:          ## logs all variables of this type
        http_status <: string [value = "400"]
        http_message <: string [value = "Missing one or more of the required parameters"]
        
    !type CustomInternalServerError [~error]: ## logs all variables of this type
        http_status <: string [value = "500"]
        http_message <: string [value = "Internal Server Error"]

Also is it possible to put in a specially formatted comment in the yaml files to allow fine-grain control of what to log?

@john-isa john-isa added the enhancement New feature or request label Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant