# central-logger

> Centralized logging. It is used to setup a server and a clients. Clients are able to send the logs to the server. Server will store the logs in different files based on its category.

Latest version **1.0.4** (published 2018-07-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install central-logger
pnpm add central-logger
yarn add central-logger
bun add central-logger
```

## 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.4 |
| Published | 2018-07-05 |
| First published | 2018-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Manoj Kumar S |
| Maintainers | manojkumars |
| Keywords | logging, remote-logging, central-logging, logger |

## Links

- npm: https://www.npmjs.com/package/central-logger
- Repository: https://github.com/KumarManoj-S/remote-logger
- Homepage: https://github.com/KumarManoj-S/remote-logger#readme
- Issues: https://github.com/KumarManoj-S/remote-logger/issues
- npm.io page: https://npm.io/package/central-logger

## Dependencies (3)

- [udp](https://npm.io/package/udp.md) ^1.0.0
- [dgram](https://npm.io/package/dgram.md) ^1.0.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1

## 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.0.4 (latest) — 2018-07-05
- 1.0.3 — 2018-07-05
- 1.0.2 — 2018-07-05
- 1.0.1 — 2018-07-05
- 1.0.0 — 2018-07-05

## README

# Central Logger
Central Logger is a tiny library for streaming the logs and info about the node application to the remote server. It is working using 'fire and forget' protocol.
## Install
Available via <a href="https://www.npmjs.com/" title="npm">npm</a>.
```
npm install central-logger
````
## Usage
Set up your remote central server :
```js
var Server = require('central-logger').Server;

//create the server
var server = new Server(
	'127.0.0.1', 		//host
    3500			//port
);

//set up the transport location
server.addTransports('/var/log/mydirectory/');

server.listen();

```

start the server,

```
node server.js
```

set up your client apps that sends the log or info to the remote server :
```js
const Client = require('central-logger').Client;

//category
const MODULE1 = 'module1';
const MODULE2 = 'module2';

//create the client logger
var logger = new Client('127.0.0.1', 3500);

```

Afterwards just log as usual:

```js
logger.log("info", "foo", MODULE1);
logger.log("warn", "bar", MODULE2);
```
It will send the log to the central server. 
The syntax for the log method is ,
```js
log(level, message, category);
```

and then on your remote server you can check the logged files,
```js
cat /var/log/mydirectory/MODULE1.log

{"level":"info","message":"foo","timestamp":"2018-07-05T10:36:41.357Z"}
```
If you don't mention any category while logging like <code>logger.log("info", "foo"); </code> it will log them into the deafult file <code>'error.log'</code>

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