Skip to content

Conversation

@alenakhineika
Copy link
Contributor

Allow users to add custom entries to mongosh logs in their scripts.

log.info('This is an info message');
log.warn('Warning!');

The custom log message will sequentially appear alongside internal mongosh messages, and will look similar to this:

{"t":{"$date":"2025-01-06T16:14:23.023Z"},"s":"I","c":"MONGOSH","id":1000000012,"ctx":"shell-api","msg":"Loading file via load()","attr":{"nested":false,"filename":"/Users/alena.khineika/custom-logging.js"}}
{"t":{"$date":"2025-01-06T16:14:23.041Z"},"s":"I","c":"MONGOSH-SCRIPTS","id":1000000054,"ctx":"custom-log","msg":"This is an info message"}
{"t":{"$date":"2025-01-06T16:14:23.041Z"},"s":"W","c":"MONGOSH-SCRIPTS","id":1000000054,"ctx":"custom-log","msg":"Warning!"}

@alenakhineika alenakhineika deleted the MONGOSH-1989-сustom-log-entries branch January 17, 2025 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants