# @iti-tic/mystica

> Logging service for Nest

Latest version **1.0.6** (published 2019-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @iti-tic/mystica
pnpm add @iti-tic/mystica
yarn add @iti-tic/mystica
bun add @iti-tic/mystica
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2019-01-18 |
| First published | 2019-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 26.9 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| Author | ITI |
| Maintainers | fjbarrena |

## Links

- npm: https://www.npmjs.com/package/@iti-tic/mystica
- npm.io page: https://npm.io/package/@iti-tic/mystica

## Dependencies (4)

- [winston](https://npm.io/package/winston.md) ^3.1.0
- [@nestjs/core](https://npm.io/package/@nestjs/core.md) ^5.0.0
- [@nestjs/common](https://npm.io/package/@nestjs/common.md) ^5.0.0
- [winston-daily-rotate-file](https://npm.io/package/winston-daily-rotate-file.md) ^3.5.0

## Recent versions

- 1.0.6 (latest) — 2019-01-18
- 1.0.5 — 2019-01-18
- 1.0.4 — 2019-01-17
- 1.0.3 — 2019-01-17
- 1.0.2 — 2019-01-14
- 1.0.1 — 2019-01-14
- 1.0.0 — 2019-01-14

## README

# Mystica

<p align="center">
  <a href="https.//www.iti.es" target="blank"><img src="https://www.iti.es/wp-content/uploads/logo-iti.svg" width="320" alt="ITI Logo" /></a>
</p>
<p align="center">
  <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>

<!-- ![travis-image](https://api.travis-ci.org/nestjs/nest.svg?branch=master)
[travis-url]: https://travis-ci.org/nestjs/nest
![linux-image](https://img.shields.io/travis/nestjs/nest/master.svg?label=linux)
[linux-url]: https://travis-ci.org/nestjs/nest

  <p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
    <p align="center">
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
  <a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
  <a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
</p> -->
  <!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
  [![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->


- [Mystica](#mystica)
  - [Information](#information)
  - [Installation](#installation)
  - [Usage](#usage)
  - [Configuration](#configuration)
  - [Feedback](#feedback)
  - [License](#license)


## Information

Mystica is an open source project that simplifies logging on Nest projects, using other existent loggers such as [winston](https://github.com/winstonjs/winston) with [winston-daily-rotate-file](https://github.com/winstonjs/winston-daily-rotate-file).

## Installation

On the root of your Nest project, run the following command:

```bash
$ npm i --save @iti/mystica
```

## Usage

`Mystica` implements the `LoggerService` interface defined by Nest, so you can replace the default Nest logger with it.

On `main.ts`:
```typescript
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { Mystica } from '@iti/mystica'

async function bootstrap() {
  const app = await NestFactory.create(AppModule, {
    logger: Mystica.forRoot(); // Replace default logger with Mystica
  });
  await app.listen(3000);
}
bootstrap();
```

## Configuration

In order to specify a configuration for Mystica, a `MysticaOptions` object must be passed to the `forRoot` method. If no options are provided, Mystica will use the default configuration.

The `MysticaOptions` interface has two fields:
- `transport`: Indicates the type of transport used
- `options` (optional): Indicates the options for the type of transport. If no options are provided, the default options for the transport specified will be used

Example:
```typescript
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { Mystica } from '@iti/mystica'
import { TransportType } from '@iti/mystica/options';

async function bootstrap() {
  const app = await NestFactory.create(AppModule, {
    logger: Mystica.forRoot({
      transport: TransportType.DAILY_ROTATE_FILE,

      options: {
        filename: "logs/%DATE%.log",
        datePattern: "YYYY-MM-DD",
        zippedArchive: false,
        maxSize: "100m",
        maxFiles: "30d"
      }
    })
  });
  await app.listen(3000);
}
bootstrap();
```

## Feedback

Pull requests and issues are welcome!

## License

Mystica is [MIT licensed](LICENSE).

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