# hapi-smart-logs

> Smart Logger for HapiJs latest version with spike usage

Latest version **1.2.7** (published 2026-08-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install hapi-smart-logs
pnpm add hapi-smart-logs
yarn add hapi-smart-logs
bun add hapi-smart-logs
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

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

## Facts

| | |
|---|---|
| Version | 1.2.7 |
| Published | 2026-08-19 |
| First published | 2020-08-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 29.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Shahab Ahmad Khan |
| Maintainers | shahabahmadkhan |
| Keywords | logs, logger, small, ipaddress, nginx, reverse proxy, hapi |

## Links

- npm: https://www.npmjs.com/package/hapi-smart-logs
- npm.io page: https://npm.io/package/hapi-smart-logs

## Dependencies (2)

- [joi](https://npm.io/package/joi.md) ^17.13.3
- [colors](https://npm.io/package/colors.md) ^1.4.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.2.7 (latest) — 2026-08-19
- 1.2.6 — 2026-08-19
- 1.2.5 — 2026-08-19
- 1.2.4 — 2026-08-19
- 1.2.3 — 2026-08-19
- 1.2.2 — 2026-08-19
- 1.2.1 — 2026-08-19
- 1.2.0 — 2026-08-19
- 1.0.28 — 2026-08-19
- 1.0.27 — 2026-08-19
- 1.0.26 — 2026-08-19
- 1.0.25 — 2026-08-19
- 1.0.23 — 2024-12-02
- 1.0.22 — 2024-06-28
- 1.0.21 — 2023-05-05
- … 20 more at https://npm.io/package/hapi-smart-logs/versions

## README

# hapi-smart-logs

Enables smart logging for a hapijs app based on config.

Default Options:  
```javascript
{
    reverseProxyIPHeaders: ['x-real-ip'],
    timestamp: false,
    logSlowRequests: false,
    requestLevel: 'short'
}
```
	

Example:
```javascript
'use strict'

const Hapi = require('hapi');

const server = Hapi.server({
    host: 'localhost',
    port: 3000
});

server.route({
    method: 'GET',
    path: '/hello',
    handler: function(request, h) {
        return h.response({greeting: "Hello there!"});
    }
});

const start = async function() {
    try {
        await server.register({
            plugin: require('hapi-smart-logs'),
            options: {
                reverseProxyIPHeaders: 'X-Forwarded-For'
            }
        })

        await server.start();
    } catch(err) {
        console.log(err);
        process.exit(1);
    }
};

start();
```

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