# true-log

Latest version **1.1.0** (published 2018-07-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install true-log
pnpm add true-log
yarn add true-log
bun add true-log
```

## 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.1.0 |
| Published | 2018-07-05 |
| First published | 2018-04-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | mujib517 |
| Keywords | request logger, logger, true logger, true log |

## Links

- npm: https://www.npmjs.com/package/true-log
- npm.io page: https://npm.io/package/true-log

## Dependencies (1)

- [on-finished](https://npm.io/package/on-finished.md) ^2.3.0

## 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

- 1.1.0 (latest) — 2018-07-05
- 1.0.2 — 2018-07-05
- 1.0.1 — 2018-07-05
- 1.0.0 — 2018-04-09
- 0.0.10 — 2018-04-06
- 0.0.8 — 2018-04-05
- 0.0.7 — 2018-04-05
- 0.0.5 — 2018-04-05
- 0.0.4 — 2018-04-05
- 0.0.3 — 2018-04-05
- 0.0.2 — 2018-04-05
- 0.0.1 — 2018-04-05

## README

# True Log  
## An Http Request Logger
<h1>
<img src="https://badge.fury.io/js/true-log.svg"/>
<img src="https://travis-ci.org/Mujib517/true-log.svg?branch=master"/>

<img src='https://coveralls.io/repos/github/Mujib517/true-logger/badge.svg?branch=tech-debt%2Fcode-coverage'/>
</h1>

## Installation
    npm install true-log --save

## Integration
```javascript
    var express = require('express');
    var trueLog = require('true-log');
    var app = express();

    var port = process.env.PORT || 3000;

    //register it as a middleware
    app.use(trueLog());
    
    app.listen(port, function () {
        console.log("Server is running on " + port);
    });

    app.get('/', function (req, res) {
        res.send("True logger works");
    });
```

## Log Level
### Tiny
```javascript
 var trueLog = require('true-log');
 app.use(trueLog({level:'tiny'}));
```
 Logs: Client IP, Date, Method, Url, UserAgent  

### Full
```javascript
 app.use(trueLog({level:'full'}));
```
 Logs: Client IP, Date, Method, Url, UserAgent, Response Time and Status code

 ## Logging to File
 By default logs would be written to console but you can redirect logs to a file by passing a writeable stream
  
  ```javascript
  var ws = fs.createWriteStream(path.join(__dirname, "log.txt"), { flags: 'a' });
  app.use(trueLog({level:'full',stream:ws}));
  ```

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