parse-community / parse-community/parse-server

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

Open
#8,716 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

New Feature / Enhancement Checklist
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing cloud-function result logging and the LoggerAdapter interface, using the current log message and log info object examples as the behavioral reference. Done means the default message no longer includes input or result JSON, while the log info metadata includes the function result for custom logger adapters.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.