New to Timber? Here's a low-down on logging in Javascript.
This NPM library is for logging in the browser.
Here's how to get started:
If you're using a module bundler like Webpack or Rollup, you can install the package directly from NPM:
npm i @timberio/browser
In ES6/Typescript, import the Timber
class:
import { Timber } from "@timberio/browser";
For CommonJS, require the package:
const { Timber } = require("@timberio/browser");
If you're not using a Node.js module bundler, you can log in any client-side app by dropping in a <script>
tag:
<script src="https://unpkg.com/@timberio/[email protected]/dist/umd/timber.js"></script>
This will place the Timber
class on window.Timber
.
You can instantiate the client in the same way, whether you use a module bundler or the <script>
tag method.
Simply pass your Timber.io API key as a parameter to a new Timber
instance:
const timber = new Timber("api-goes-here");
This browser library extends @timberio/core
, which provides a simple API for logging, adding middleware and more.
Visit the relevant readme section for more info/how-to: