How to use laabr - 2 common examples

To help you get started, we’ve selected a few laabr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github superchargejs / framework / bootstrap / app.js View on Github external
'use strict'

require('./globals')

const Hapi = require('hapi')
const Path = require('path')
const Config = util('config')
const Laabr = require('laabr')
const Inert = require('inert')
const Vision = require('vision')
const Globby = require('globby')
const Handlebars = require('./views')

// configure hapi response logging format
Laabr.format('log', ':time :level :message')

class Bootstrap {
  async launchWeb() {
    // create new web instance
    // add web’s connection information
    const web = new Hapi.Server({
      host: 'localhost',
      port: Config.get('app.port')
    })

    // register plugins to web instance
    await web.register([
      Inert,
      Vision,
      {
        plugin: require('hapi-dev-errors'),
github superchargejs / framework / bootstrap / app.js View on Github external
port: Config.get('app.port')
    })

    // register plugins to web instance
    await web.register([
      Inert,
      Vision,
      {
        plugin: require('hapi-dev-errors'),
        options: {
          showErrors: Config.get('app.env') !== 'production',
          useYouch: true
        }
      },
      {
        plugin: Laabr.plugin,
        options: {
          colored: true,
          hapiPino: {
            logPayload: false
          }
        }
      }
    ])

    this.configureViews(web)

    const middlewarePath = Path.resolve(__appRoot, 'boost', 'middleware')
    const boostMiddlewares = await this.loadHapiPluginsFromFolder(middlewarePath)
    await web.register(boostMiddlewares)

    // register Web plugins created by the user

laabr

well-formatted, extendable pino logger for hapi.js

MIT
Latest version published 4 years ago

Package Health Score

45 / 100
Full package analysis

Popular laabr functions