Skip to content

cloud function result metadata appended to log message body instead of log info object #8716

@westhom

Description

@westhom
Contributor

New Feature / Enhancement Checklist

  • I am not disclosing a vulnerability.
    I am not just asking a question.
    I have searched through existing issues.

Current Limitation

Parse logs the result of executed cloud functions to the console. It appends JSON of the input and result of the cloud function to the log message string. This makes it difficult to have clean, succinct log messages in favor of handling that metadata in your own log message adapter effectively.

Example current output:

info: Ran cloud function create-user for user undefined with:
  Input: {"username":"plugin-test","roles":["plugin"]}
  Result: {"username":"plugin-test","createdAt":"2023-08-26T14:00:58.297Z","updatedAt":"2023-08-26T14:00:58.297Z","objectId":"II0B5vsXpz","__type":"Object","className":"_User"} {"functionName":"create-user","params":{"roles":["plugin"],"username":"plugin-test"}}

Current log info metadata for cloud function calls:

{
  functionName: 'create-user',
  params: { username: 'plugin-test', roles: [ 'plugin' ] },
  user: undefined
}

Feature / Enhancement Description

Parse could not append potentially messy JSON to a log message string in favor of adding it to log info metadata, which lets developers decide if they want to output it via their own LoggerAdapter.

Example new default logger output:

info: Ran cloud function create-user for user undefined

Example new log info object:

{
  functionName: 'create-user',
  params: { username: 'plugin-test', roles: [ 'plugin' ] },
  user: undefined,
  result: { ... }
}

Example Use Case

  1. Makes Parse-generated logs more clean
  2. Gives more metadata to the log object, removing opinion about log message format
  3. Custom LoggerAdapter can print out more complex message if needed

Alternatives / Workarounds

Custom LoggerAdapter can do a string search to discover cloud function logs and split by \n to extract the appended JSON to clean up the log, and then parse it further if needed.

3rd Party References

Activity

parse-github-assistant

parse-github-assistant commented on Aug 26, 2023

@parse-github-assistant

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!
added
type:featureNew feature or improvement of existing feature
bounty:$10Bounty applies for fixing this issue (Parse Bounty Program)
on Aug 27, 2023
prajwalbandak

prajwalbandak commented on Sep 16, 2023

@prajwalbandak

Hey @mtrezza , Can you please assign this issue, would love to work on this?
Meanwhile as a beginner in open source please free to explain the things to do?

mtrezza

mtrezza commented on Sep 16, 2023

@mtrezza
Member

@prajwalbandak We generally do not assign issues; please feel free to submit a PR we'll be happy to review.

To get started we have a blog article that is especially directed towards first time contributors and a more technical Contribution Guide.

prajwalbandak

prajwalbandak commented on Sep 17, 2023

@prajwalbandak

@mtrezza , I Need some help to understand the issue, as a beginner in open source, it is kind to understand a large part of the codebase.

mtrezza

mtrezza commented on Sep 18, 2023

@mtrezza
Member

If you have a specific question you could post it here. Other than that maybe you want to look for an easier issue to start with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bounty:$10Bounty applies for fixing this issue (Parse Bounty Program)type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @westhom@mtrezza@prajwalbandak

        Issue actions

          cloud function result metadata appended to log message body instead of log info object · Issue #8716 · parse-community/parse-server