@timberio/tools
Advanced tools
Comparing version 0.21.0 to 0.22.0
# License | ||
Copyright (c) 2018, Timber Technologies, Inc. | ||
Copyright (c) 2018. Timber Technologies, Inc. | ||
@@ -5,0 +5,0 @@ Permission to use, copy, modify, and/or distribute this software for any purpose |
{ | ||
"name": "@timberio/tools", | ||
"version": "0.21.0", | ||
"version": "0.22.0", | ||
"description": "Javascript logging tools", | ||
@@ -36,6 +36,6 @@ "main": "dist/cjs/index.js", | ||
}, | ||
"gitHead": "ad47bc5850606d875f014d39f5a81daf87810729", | ||
"gitHead": "40597144b884fdb8481049eac289b7ff9015a671", | ||
"dependencies": { | ||
"@timberio/types": "^0.21.0" | ||
"@timberio/types": "^0.22.0" | ||
} | ||
} |
@@ -1,5 +0,11 @@ | ||
# 🌲 Timber - Javascript tools | ||
# 🌲 Timber - JS lib tools | ||
## 👷️ WIP - Don't use yet! Use [this Timber JS lib](https://github.com/timberio/timber-node) for now | ||
![Beta: Ready for testing](https://img.shields.io/badge/early_release-beta-green.svg) | ||
![Speed: Blazing](https://img.shields.io/badge/speed-blazing%20%F0%9F%94%A5-brightgreen.svg) | ||
[![ISC License](https://img.shields.io/badge/license-ISC-ff69b4.svg)](LICENSE.md) | ||
**New to Timber?** [Here's a low-down on logging in Javascript.](https://github.com/timberio/timber-js) | ||
## `@timberio/tools` | ||
This library provides helper tools used by the [Javascript logger](https://github.com/timberio/timber-js). | ||
@@ -13,2 +19,4 @@ | ||
Used to store `.log()` Promises that are being batched/throttled. | ||
**Usage example** | ||
@@ -80,2 +88,27 @@ | ||
### `makeBatch(size: number, flushTimeout: number)` | ||
Creates a higher-order batch function aggregates Timber logs and resolves when either `size` # of logs have been collected, or when `flushTimeout` (in ms) has elapsed -- whichever occurs first. | ||
This is used alongside the throttler to provide an array of [`ITimberLog`](https://github.com/timberio/timber-js/tree/master/packages/types#itimberlog) to the function set in the `.setSync()` method, to be synced with [Timber.io](https://timber.io) | ||
Used internally by the [`@timberio/core Base class`](https://github.com/timberio/timber-js/blob/master/packages/core/src/base.ts) to implicitly batch logs: | ||
```typescript | ||
// Create a throttler, for sync operations | ||
const throttle = makeThrottle(this._options.syncMax); | ||
// Sync after throttling | ||
const throttler = throttle((logs: any) => { | ||
return this._sync!(logs); | ||
}); | ||
// Create a batcher, for aggregating logs by buffer size/interval | ||
const batcher = makeBatch(this._options.batchSize, this._options.batchInterval); | ||
this._batch = batcher((logs: any) => { | ||
return throttler(logs); | ||
}); | ||
``` | ||
### `base64Encode(str: string): string` | ||
@@ -96,1 +129,5 @@ | ||
``` | ||
### LICENSE | ||
[ISC](LICENSE.md) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125218
131
+ Added@timberio/types@0.22.0(transitive)
- Removed@timberio/types@0.21.0(transitive)
Updated@timberio/types@^0.22.0