@hood/hoodjs-logger
Hood trace logger library
Last updated 18 days ago by asafsemo .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @hood/hoodjs-logger 
SYNC missed versions from official npm registry.

Kubernetes + Hood logger + Hood agent => APM

Hood Logger

Jaeger trace example

Motivation

My biggest motivation behind creating Hood project is to provide APM for each project without the need to integrate special libraries into the code. Each developer from the first line he writes in any project includes writing logs, I find there is a lot of data in those logs and with the usage of hood logger and agent in the Kubernetes environment we can provide you a lot of data. The amazing gain each developer is getting by using hood logger & agent is the separation of concern between the business logic of your project and the monitoring of the code. Clean Architecture recommend this approach. Each integration of additional external service will be handled by the hood agent, and the requirements from the developer will always be to add more information in the logs.

Quick start

Several ways to use Hood logger in a project, please review our example folder. tasks:

  • Add dependency in file package.json – "@hood/hoodjs-logger": "^2.0.2"

NOTE: using Bunyan CLI on the developer machine will transform the logs from json object to a text line which can be read by human :)

In order to install Hood Agent send an email to: asafsemo@gmail.com

Installation

npm install --save @hood/hoodjs-logger

Usage

The recommended way to use hood logger, we recommend the minimum usage of log lines that are not related to traces.

Table of content

Integration to external systems

At the current time Hood agent is sending data to hood servers, and Jaeger (https://www.jaegertracing.io/)

Screenshot from Hood service:

Hood Web UI

Future integrations: Loggly (https://www.loggly.com/), Sentry (https://sentry.io/welcome/), Logz.io (https://logz.io/)

Logging

Log levels

verbose: 10,
debug  : 20,
info   : 30,
warn   : 40,
error  : 50,
fatal  : 60,

Logger functions

constructor - new HoodLogger listenUncaughtException - rootTraceId - currentTraceId - createRootTraceLogger - createChildTraceLogger - getTraceContext - verbose - debug - info - warn - error - fatal - end - complete -

Trace Logger

Create root trace logger

createRootTraceLogger -

Create child trace logger

createChildTraceLogger -

Logger create params

Logger format

the logger is printing out log in a JSON format

Using bunyan CLI on developer computer

Sending JSON objects between services is good, while developing the human eye understand text better, in order to transform the JSON object to a text line you should use Bunyan CLI as pipe

Examples

Code snippets

Installing Hood agent on Kubernetes and receiving APM

Please contact us by sending an email to asafsemo@gmail.com in order to get more information how to install Hood agent.

Exceptions

Handling uncaught exception

Tests

const a = hello;

Author: [Asaf Semo]

Current Tags

  • 2.0.4                                ...           latest (18 days ago)

6 Versions

  • 2.0.4                                ...           18 days ago
  • 2.0.3                                ...           2 months ago
  • 2.0.2                                ...           9 months ago
  • 2.0.1                                ...           10 months ago
  • 2.0.0                                ...           10 months ago
  • 1.0.0 [deprecated]           ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 6
Last Month 21
Dependencies (0)
None
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |