1.0.22 • Published 5 months ago

hapi-smart-logs v1.0.22

Weekly downloads
10
License
ISC
Repository
-
Last release
5 months ago

hapi-smart-logs

Enables smart logging for a hapijs app based on config.

Default Options:

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

Example:

'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();
1.0.22

5 months ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

3 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago