# @turnkeyid/sexy-logger

> ready to use logger with file rotation

Latest version **1.0.13** (published 2022-04-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @turnkeyid/sexy-logger
pnpm add @turnkeyid/sexy-logger
yarn add @turnkeyid/sexy-logger
bun add @turnkeyid/sexy-logger
```

Provides the command `my-command`.

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.13 |
| Published | 2022-04-20 |
| First published | 2021-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14.17.6 |
| Dependencies | 10 |
| Unpacked size | 177.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | TurnkeyID Developers |
| Maintainers | fatihaziz, gigihiski |
| Keywords | turnkeyid |

## Links

- npm: https://www.npmjs.com/package/@turnkeyid/sexy-logger
- Issues: https://github.com/turnkey-devs
- npm.io page: https://npm.io/package/@turnkeyid/sexy-logger

## Dependencies (10)

- [dotenv](https://npm.io/package/dotenv.md) ^10.0.0
- [nanoid](https://npm.io/package/nanoid.md) ^3.1.30
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.2
- [winston](https://npm.io/package/winston.md) ^3.3.3
- [deepmerge-ts](https://npm.io/package/deepmerge-ts.md) ^4.0.3
- [app-root-path](https://npm.io/package/app-root-path.md) ^3.0.0
- [dotenv-expand](https://npm.io/package/dotenv-expand.md) ^5.1.0
- [serialize-error](https://npm.io/package/serialize-error.md) ^8.1.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13
- [winston-daily-rotate-file](https://npm.io/package/winston-daily-rotate-file.md) ^4.5.5

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.13 (latest) — 2022-04-20
- 1.0.11 — 2022-03-24
- 1.0.10 — 2022-02-07
- 1.0.9 — 2021-12-20
- 1.0.8 — 2021-12-20
- 1.0.7 — 2021-11-13
- 1.0.6 — 2021-11-12
- 1.0.5 — 2021-10-26
- 1.0.4 — 2021-09-27
- 1.0.3 — 2021-09-24
- 1.0.0 — 2021-09-23

## README

# Welcome to TurnkeyID Sexy Logger! 💌 👋

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](#)
[![Author: @fatihaziz](https://img.shields.io/badge/Author-@fatihaziz-blue.svg)](#)
[![Community: TurnkeyID Devs](https://img.shields.io/badge/Community-TurnkeyID_Devs-orange.svg)](#)

> _Simple pretty logger console and save logs into file daily (with error/exception handler)_


### Goal
 - Services can get their own, standarized and pretty system logger.
 - Services can call simple logger function anywhere
 - Logs all important message and save it into seperated logger file for easy debuging

### How to use
1. install this package 
   ```sh
   npm install --save @turnkeyid/sexy-logger
   # or
   yarn add @turnkeyid/sexy-logger
   ```
2. create your own logger function:
   ```typescript
      // ./helpers/my-logger.ts
      import { LoggerServiceFactory } from '@turnkeyid/sexy-logger'
      import path from 'path'

      const MyLoggerService = LoggerServiceFactory.createLoggerService({
      	consoleSilent: false,
      	consoleMode: 'VERBOSE',
      	consoleShowDump: true,
      	consoleIgnoredLevels: ['SILLY'],
      	censoredKeys: ['cencored','password'],
      	loggerDir: path.resolve(__dirname,'logs'),
      })

      export const myLogger = MyLoggerService.createLoggerFn('MY-TYPE') 
      
   ```
3. import it somewhere:
   ```typescript

      // ./index.ts
      import {myLogger} from './helpers/my-logger.ts'
      myLogger(module,'title',{ data:{ any:'data' } },'SILLY')
      myLogger(module,'error title',{ error:new Error('caught error') },'ERROR')

      someAsync = async()=>{
      	// do something
      }
      someAsync().then((data)=>{
            myLogger(module,'success!',{ data },'INFO')
      }).catch((error)=>{
            myLogger(module,'error!',{ error },'ERROR')
      })

   ```
4. if you got `"cannot create logger instance"`, try to set `process.env.SEXY_LOGGER_MAX_INSTANCE=` higher than current value.

### Preview Sample

![alt sample.png](./samples/sample.png?raw=true)

### Author
👷‍♀️ **TurnkeyID Developers - Fatihaziz**
* Website: turnkey.id
* Github: [@turnkey-devs](https://github.com/turnkey-devs)
* Fatih's Github: [@fatihaziz](https://github.com/fatihaziz)

### Question
<p>
if you have any question, please contact here:
<ul>
   <li>

[developer@turnkey.id](mailto:developer@turnkey.id)
   
   </li>
   <li>
   
[fatih@turnkey.id](mailto:fatih@turnkey.id)

   </li>
</ul>
</p>

### Show your support

Give a ⭐️ if this project helped you!

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