# ts-dev-logger

> A development tool that allows you to log data to the console and to the file.

Latest version **0.1.5** (published 2022-11-11) · Apache 2.0 license · 0 weekly downloads

## Install

```sh
npm install ts-dev-logger
pnpm add ts-dev-logger
yarn add ts-dev-logger
bun add ts-dev-logger
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2022-11-11 |
| First published | 2022-11-07 |
| Weekly downloads | 0 |
| License | Apache 2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 41.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | tejks |
| Maintainers | tejks |
| Keywords | typescript, log, logger, file, console |

## Links

- npm: https://www.npmjs.com/package/ts-dev-logger
- Repository: https://github.com/tejks/ts-dev-logger
- Homepage: https://github.com/tejks/ts-dev-logger#readme
- Issues: https://github.com/tejks/ts-dev-logger/issues
- npm.io page: https://npm.io/package/ts-dev-logger

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [moment](https://npm.io/package/moment.md) ^2.29.4

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.1.5 (latest) — 2022-11-11
- 0.1.4 — 2022-11-07
- 0.1.3 — 2022-11-07
- 0.1.2 — 2022-11-07
- 0.1.1 — 2022-11-07
- 0.1.0 — 2022-11-07

## README

<div align="center">
<h1>ts-dev-logger</h1>

<p>A development tool that allows you to log data to the console and to the file.</p>

<p>
    <a href="#installation"><strong>Installation</strong></a> ·
    <a href="#logger---params"><strong>Params</strong></a> ·
    <a href="#quick-guide---console"><strong>Quick Guide</strong></a> ·
    <a href="#license"><strong>License</strong></a>
 </p>
 
 </br>

[![Package Version][package-image]][package-url]
<img src="https://img.shields.io/badge/platform-node-lightgrey.svg?style=flat" alt="platform">
<img src="https://img.shields.io/badge/license-Apache2-blue.svg?style=flat" alt="Apache 2">

[package-image]: https://badge.fury.io/js/typescript-template.svg
[package-url]: https://www.npmjs.com/package/ts-dev-logger
</div>

## Installation
```bash
npm i ts-dev-logger
```
or

```bash
yarn add ts-dev-logger
```
---

## Logger - params

- dateType:
    - UTCDate
    - FullDate (default)
    - ShortTime
    - Time

<img src="./images/data_type.png" alt="data_type" width="500"/>

---

## Quick Guide - console

#### -- Basic Usage --
```js
export const logger = new Logger({dateType: 'Time'})
const consoleLogger = new ConsoleLogger()

logger.constructLogger(consoleLogger)

logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'ERROR'})
logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'WARNING'})
logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'INFO'})
logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'NOTICE'})
logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'OK'})
logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'CRIT'})
```
#### -- Result --
![Alt text](./images/log_console.png)

---

## Quick Guide - file

#### -- File Params --

- path — relative path to create logs folders (default: "./logs")

#### -- Basic Usage --
```js
export const logger = new Logger({dateType: 'Time'})
const fileLogger = new FileLogger({})

logger.constructLogger(fileLogger)

logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'ERROR'})
logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'WARNING'})
logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'INFO'})
logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'NOTICE'})
logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'OK'})
logger.log({message: 'Lorem Ipsum is simply dummy text', type: 'CRIT'})
```
#### -- Result --
![Alt text](./images/log_file.png)

---

## Contributing

We welcome all types of contributions, either code fixes, new features or doc improvements.
Code formatting is enforced by [prettier](https://prettier.io/).
For commits please follow conventional [commits convention](https://www.conventionalcommits.org/en/v1.0.0-beta.2/).
All code must pass lint rules and test suites before it can be merged into develop.

---

## License

ts-dev-logger is licensed under the Apache License, Version 2.0.

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