///
import * as winston from "winston";
import { ServiceType, ServiceResult } from "./types";
/**
* Trace the service by milliseconds
* @class XTracer
*/
export default class XTracer {
MS_PER_SECOND: number;
NS_PER_SECOND: number;
private _debug;
private _logger;
private _tracer;
constructor(opts: {
debug?: boolean;
logger?: winston.Winston;
});
/**
* Begin tracer
* @param sid Service ID. Ex: XUser.User.SignUp
*/
begin(sid: string): void;
/**
* Trace service stack
* @param sid Service ID. Ex: XUser.User.SignUp
* @param info Trace stack information
*/
trace(sid: string, info: {
sid: string;
type: ServiceType;
duration: number;
params?: any[];
sResult?: ServiceResult;
}): void;
/**
* End tracer
* @param sid Service ID. Ex: XUser.User.SignUp
* @param sResult Service result
*/
end(sid: string, sResult: ServiceResult): void;
/**
* Break current tracer
* @param info Error information
*/
error(sid: string, error: Error, extra: {
[index: string]: any;
}): void;
/**
* Convert [seconds, nanoseconds] to milliseconds
* @param {Array} hrtime Result of process.hrtime, with format [seconds, nanoseconds]
* @returns {number} Milliseconds
*/
toMilliseconds(hrtime: [number, number]): number;
}