Skip to content

Instantly share code, notes, and snippets.

@binarylogic
Created October 17, 2017 18:07
Show Gist options
  • Select an option

  • Save binarylogic/23efa79919a49d8e65ca9a13094c970a to your computer and use it in GitHub Desktop.

Select an option

Save binarylogic/23efa79919a49d8e65ca9a13094c970a to your computer and use it in GitHub Desktop.
Example of using LogEntry directly with the Timber node library
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