Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

airgram/airgram-debug

Repository files navigation

Airgram debug

Extends base Airgram logger.

Installation

npm install airgram-debug

Basic usage with TypeScript:

import { ag, TYPES } from 'airgram'
import { getCalleeName } from 'airgram/helpers'
import DebugLogger from 'airgram-debug'

airgram.bind<ag.Logger & { level: string }>(TYPES.Logger).to(DebugLogger)
  .onActivation((context, logger) => {
    logger.namespace = [getCalleeName(context)]
    logger.level = 'verbose'
    return logger
  })

Basic usage with JavaScript:

const {Airgram, AuthDialog, TYPES} = require('airgram')
const {getCalleeName} = require('airgram/helpers')
const DebugLogger = require('airgram-debug')

airgram.bind(TYPES.Logger).to(DebugLogger).onActivation((context, logger) => {
  logger.namespace = [getCalleeName(context)]
  logger.level = 'verbose'
  return logger
})