Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WBRIDGE and version 24.0

Otp

The

...

Module

Syntax
Code Block
languagejs
require('e2e-transaction-logger');
SemanticsThe module itself is an object of type TransactionLogger.
Examples
Code Block
languagejs
var transactionLogger = require('e2e-transaction-logger');
var trx = transactionLogger.startTransaction('MyTransaction');

You can use directly the module to trace transactions

Anchor
TransactionLogger
TransactionLogger
TransactionLogger

constructor

Syntax
Code Block
languagenone
TransactionLogger.constructor(logPath)
SemanticsCreates an object of type TransactionLogger.
ArgumentslogPath The path where the log files will be written.
Examples
Code Block
languagejs
var TransactionLogger = require('e2e-transaction-logger').TransactionLogger;
var myTransactionLogger = new TransactionLogger('my/custom/log/path');

...

startTransaction

Syntax
Code Block
languagenone
TransactionLogger.startTransaction(name)
SemanticsTraces the start of a transaction and return a Transaction object.
Argumentsname The name of the transaction.
Examples
Code Block
languagejs
var trx = transactionLogger.startTransaction('MyTransaction');

processLogger

Syntax
Code Block
languagejs
require('e2e-transaction-logger').processLogger;
SemanticsAn object of type ProcessLogger.
Examples
Code Block
languagejs
var transactionLogger = require('e2e-transaction-logger');
transactionLogger.processLogger.processStart('ProcessName', 'processId', 'StartEventName');

Anchor
ProcessLogger
ProcessLogger
ProcessLogger

constructor

Syntax
Code Block
languagenone
ProcessLogger.constructor(logPath)
SemanticsCreates an object of type ProcessLogger.
ArgumentslogPath The path where the log files will be written.
Examples
Code Block
languagejs
var ProcessLogger = require('e2e-transaction-logger').ProcessLogger;
var myProcessLogger = new ProcessLogger('my/custom/log/path');

...

processStart

Syntax
Code Block
languagenone
ProcessLogger.processStart(processName, processId, eventName)
Semantics Traces the start of a process.
Arguments

processName 
The name of the process.
processId
The process id.
eventName
The start event name.
Examples
Code Block
languagejs
processLogger.processStart('ProcessName', 'processId', 'StartEventName');

processEnd

Syntax
Code Block
languagenone
ProcessLogger.processEnd(processName, processId, eventName)
Semantics Traces the end of a process.
Arguments

processName 
The name of the process.
processId
The process id.
eventName
The end event name.
Examples
Code Block
languagejs
processLogger.processEnd('ProcessName', 'processId', 'EndEventName');

processStateStart

Syntax
Code Block
languagenone
ProcessLogger.processStateStart(processName, processId, stateName)
Semantics Traces the start of a state.
Arguments

processName 
The name of the process.
processId
The process id.
stateName
The state name.
Examples
Code Block
languagejs
processLogger.processStateStart('ProcessName', 'processId', 'StateName');

processStateEnd

Syntax
Code Block
languagenone
ProcessLogger.processStateStart(processName, processId, stateName)
Semantics Traces the end of a state.
Arguments

processName 
The name of the process.
processId
The process id.
stateName
The state name.
Examples
Code Block
languagejs
processLogger.processStateEnd('ProcessName', 'processId', 'StateName');

processChoice

Syntax
Code Block
languagenone
ProcessLogger.processChoice(processName, processId, gateway, choice)
Semantics Traces a choice.
Arguments


processName 
The name of the process.
processId
The process id.
gateway
The gateway name.
choice
The choice name.
Examples
Code Block
languagejs
processLogger.processChoice('ProcessName', 'processId', 'Gateway', 'Choice');

processEvent

Syntax
Code Block
languagenone
ProcessLogger.processEvent(processName, processId, eventName)
Semantics Traces an event.
Arguments

processName 
The name of the process.
processId
The process id.
eventName
The eventname.
Examples
Code Block
languagejs
processLogger.processStateStart('ProcessName', 'processId', 'EventName');

processValueString

Syntax
Code Block
languagenone
ProcessLogger.processValueString(processName, processId, key, value)
Semantics Traces a value of a String type.
Arguments


processName 
The name of the process.
processId
The process id.
key
The key.
value
The value
Examples
Code Block
languagejs
processLogger.processValueString('ProcessName', 'processId', 'Key', 'MyValue');

processValueFloat

Syntax
Code Block
languagenone
ProcessLogger.processValueFloat(processName, processId, key, value)
Semantics Traces a value of a Float type.
Arguments


processName 
The name of the process.
processId
The process id.
key
The key.
value
The value
Examples
Code Block
languagejs
processLogger.processValueString('ProcessName', 'processId', 'Key', 123.456);

processValueDateTime

Syntax
Code Block
languagenone
ProcessLogger.processValueDateTime(processName, processId, key, value)
Semantics Traces a value of a Date type.
Arguments


processName 
The name of the process.
processId
The process id.
key
The key.
value
The value
Examples
Code Block
languagejs
processLogger.processValueString('ProcessName', 'processId', 'Key', new Date());

Anchor
Transaction
Transaction
Transaction


A Transaction object is returned by the startTransaction method of a TransactionLogger. It is then used to trace what happens inside the transaction using startIO or any ProcessLogger method. Using transactions to trace processes instead of a ProcessLogger directly allows you to correlate the process steps and IOs of these transactions.

end

Syntax
Code Block
languagenone
Transaction.end(state)
Semantics Traces the end of a transaction.
Arguments
state
  The state of the transaction. It can be true or 'OK' for a success, false or 'ERROR' for a failed. Default: 'OK'
Examples
Code Block
languagejs
var trx = transactionLogger.startTransaction('MyTransaction');

// do some things

trx.end();

startIO

Syntax
Code Block
languagenone
Transaction.startIO(name, domain, system)
Semantics Trace the start of an IO call and return an IO object.
Arguments

name
The name of the IO call
domain
The domain of the IO call
system
The system of the IO call
Examples
Code Block
languagejs
var io = trx.startIO('SELECT Users','SQL','oracle/XE');

Anchor
IO
IO
IO

An IO object is returned by the startIO method of a Transaction. It is then used to trace the end of the IO call.

end

Syntax
Code Block
languagenone
IO.end(state)
Semantics Traces the end of a IO call.
Arguments
state
  The state of the IO call. It can be true or 'OK' for a success, false or 'ERROR' for a failed. Default: 'OK'
Examples
Code Block
languagejs
var io = trx.startIO('Read','FILE','HelloWorld.txt');

fs.readFile(__dirname + '/resource/HelloWorld.html',function(err, data){
    io.end();
});

transactionLoggerMiddleware

A function that returns a middle ware which can be used with express. It will automatically start a transaction when a request arrives and end it when the response is sent. The Transaction object will be available in the request object as trx.

Arguments

options
  object
  • logPath
The path where the log files will be written.
  • name
The name that should be given to the transactions. Can be a function taking the request and response as parameter and returning the name. By default the name will be the URL of the request.
Examples
Code Block
languagejs
var express = require('express');
var fs = require('fs');
var transactionLoggerMiddleware = require('e2e-transaction-logger').transactionLoggerMiddleware;

var app = express();

app.use(transactionLoggerMiddleware());

app.get('/hello.html', function(req, res){
    var io = req.trx.startIO('Read','FILE','HelloWorld.html');

    fs.readFile(__dirname + '/resource/HelloWorld.html',function(err, data){
        if(err){
            io.end('ERROR');    
            res.send(503, err); // the status code define if the transaction failed or succeed. >= 400 it failed
            return;
        }

        io.end();
        res.set('Content-Type', 'text/html');
        res.send(data);
    });
});
Panel
titleOn this Page:
Table of Contents