Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@timberio/types

Package Overview
Dependencies
Maintainers
5
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@timberio/types - npm Package Compare versions

Comparing version 0.21.0 to 0.22.0

2

LICENSE.md
# 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/types",
"version": "0.21.0",
"version": "0.22.0",
"description": "Timber.io - Typescript types",

@@ -40,3 +40,3 @@ "keywords": [

},
"gitHead": "ad47bc5850606d875f014d39f5a81daf87810729",
"gitHead": "40597144b884fdb8481049eac289b7ff9015a671",
"dependencies": {

@@ -43,0 +43,0 @@ "js": "^0.1.0"

@@ -1,7 +0,104 @@

# 🌲 Timber - Shared typescript types
# 🌲 Timber - Shared Typescript types
## 👷‍️ 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)
Typescript types used by the Timber.io Javascript logger.
**New to Timber?** [Here's a low-down on logging in Javascript.](https://github.com/timberio/timber-js)
> Docs TBA
## `@timberio/types`
The Timber JS library packages are written in Typescript.
Various types are shared between multiple packages. Those shared types have been separated out into their own package, to make it easier for importing.
That's what you'll find in this package.
### Importing types
You can import a shared type into a Typescript project by importing directly from this package:
```typescript
// For example, `ITimberLog`
import { ITimberLog } from "@timberio/types";
```
## Types
### `ITimberOptions`
Config options for the Timber [Base class](https://github.com/timberio/timber-js/tree/master/packages/core#the-base-class) for creating a Timber client instance.
```typescript
interface ITimberOptions {
/**
* Endpoint URL for syncing logs with Timber.io
*/
endpoint: string;
/**
* Maximum number of logs to sync in a single request to Timber.io
*/
batchSize: number;
/**
* Max interval (in milliseconds) before a batch of logs proceeds to syncing
*/
batchInterval: number;
/**
* Maximum number of sync requests to make concurrently (useful to limit
* network I/O)
*/
syncMax: number;
}
```
### `LogLevel`
Enum representing a log level between _debug_ -> _error_:
```typescript
enum LogLevel {
Debug = "debug",
Info = "info",
Warn = "warn",
Error = "error"
}
```
### `ITimberLog`
The log object which is implicitly created by calling `.log()` (or any explicit log level function - e.g. `.info()`), and is passed down the chain for Timber middleware before syncing with [Timber.io](https://timber.io)
```typescript
interface ITimberLog {
$schema: "https://raw.githubusercontent.com/timberio/log-event-json-schema/v4.1.0/schema.json";
dt: Date;
level: LogLevel; // <-- see `LogLevel` above
message: string;
context?: object;
}
```
### `Middleware`
A type representing a [Middleware function](https://github.com/timberio/timber-js/tree/master/packages/core#middleware) passed to `.use()` (or `.remove()`)
```typescript
type Middleware = (log: ITimberLog) => Promise<ITimberLog>;
```
### `Sync`
The type of the function passed to `.setSync()`, for syncing a log with [Timber.io](https://timber.io):
Note: Differs from the `Middleware` type because it receives - and resolves to a Promise of - an array of batched `ITimberLog`.
```typescript
Sync = (logs: ITimberLog[]) => Promise<ITimberLog[]>
```
### LICENSE
[ISC](LICENSE.md)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc