Created
October 17, 2017 18:07
-
-
Save binarylogic/23efa79919a49d8e65ca9a13094c970a to your computer and use it in GitHub Desktop.
Example of using LogEntry directly with the Timber node library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const timber = require('timber') | |
| const timber_transport = new timber.transports.HTTPS('your-api-key') | |
| // The second argument must follow the structure defined in the Timber log event JSON schema: | |
| // https://github.com/timberio/log-event-json-schema | |
| log_entry = new timber.LogEntry('my log message', {context: {http: {method: 'GET', request_id: 'abcd1234'}}}) | |
| // It's important that you pass the `data` object here. | |
| timber_transport.write(log_entry.data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment