Skip to content

av/tohu

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 

TOHU

Code Trace
before => after

Some information is just not suitable to be presented as logs and requires different visualisation. Good example are http calls performed by a server during processing of incoming request or events in a distributed system coming in undetermenistic order and duration. Tohu can help transforming such information into format compatible with Chrome's about://tracing, which is awesome frontend for any traces and available almost everywhere alongside with Chrome.

Quickstart

  • Install tohu
npm i tohu --save
  • Include it in your sources
const tohu = require('tohu');

// one eternity later
tohu.toFile('trace.json');
  • View results with chrome tracing frontend
    • Open chrome://tracing in Google Chrome
    • Click "Load" at top left corner
    • Select trace file stored by tohu

Config

Tohu supports following configuration options with tohu.setup() call:

{
  // Enable/disable internal logging of
  // additional debug infor
  quiet: true,
  
  // When true, tohu will store request/response pair bodies 
  // for further analysis. Significantly increases trace file size.
  storeBody: false,
  
  // Allows to specify transport for loggins, transport should suppoort 
  // three levels as methods: debug, info, error
  log: console,
  
  // Defines output format of trace file. Defaults to Chrome's about://tracing
  format: 'chrome-tracing',
  
  // Filename to use for storing trace. Will be stored
  // inside the same directory from which node.js programm was launched
  file: 'tohu.json'
}