# nestjs-logspot

> NestJS Module for logspot.io

Latest version **0.1.2** (published 2022-05-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install nestjs-logspot
pnpm add nestjs-logspot
yarn add nestjs-logspot
bun add nestjs-logspot
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2022-05-28 |
| First published | 2022-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 11.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mihai Voinea |
| Maintainers | mihaivoinea_ |
| Keywords | nestjs |

## Links

- npm: https://www.npmjs.com/package/nestjs-logspot
- Repository: https://github.com/MihaiVoinea/nestjs-logspot
- Homepage: https://github.com/MihaiVoinea/nestjs-logspot#readme
- Issues: https://github.com/MihaiVoinea/nestjs-logspot
- npm.io page: https://npm.io/package/nestjs-logspot

## Dependencies (3)

- [rxjs](https://npm.io/package/rxjs.md) ^7.x
- [@logspot/node](https://npm.io/package/@logspot/node.md) ^2.0.4
- [@golevelup/nestjs-modules](https://npm.io/package/@golevelup/nestjs-modules.md) ^0.4.3

## Recent versions

- 0.1.2 (latest) — 2022-05-28
- 0.1.1 — 2022-05-28
- 0.1.0 — 2022-05-28

## README

<h1 align="center">nestjs-logspot</h1>

<p align="center">Injectable Logspot wrapper for NestJS</p>

<div align="center">
  <a href="https://nestjs.com" target="_blank">
    <img src="https://img.shields.io/badge/built%20with-NestJs-red.svg" alt="Built with NestJS">
  </a>
</div>

## Installation

```bash
npm install --save nestjs-logspot
```

## Getting Started

The simplest way to use `nestjs-logspot` is to use `LogspotModule.forRoot`

```typescript
import { Module } from '@nestjs-common';
import { LogspotModule } from 'nestjs-stripe';

@Module({
  imports: [
    LogspotModule.forRoot({
      // Recommendation: Use env vars to store the secret key
      secretKey: 'sk_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    }),
  ],
})
export class AppModule {}
```

You can then inject Logspot into any of your injectables by using a custom decorator

```typescript
import { Injectable } from '@nestjs/common';
import { InjectLogspot, LogspotService } from 'nestjs-stripe';

@Injectable()
export class AppService {
  constructor(@InjectLogspot() private readonly logspotService: LogspotService) {}
}
```

After you injected Logspot, you can use the track function to send events.

```typescript
import { Injectable } from '@nestjs/common';
import { InjectLogspot, LogspotService } from 'nestjs-stripe';

@Injectable()
export class AppService {
  constructor(@InjectLogspot() private readonly logspotService: LogspotService) {}

  sendEvent(account) {
    this.logspotService.track({
      event: 'account.created',
      userId: account.id,
      metadata: { email: account.email },
    });
   }
}
```
## License

Licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---
_Source: https://npm.io/package/nestjs-logspot · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
