2019-10-22 13:10:32 +00:00
|
|
|
import * as plugins from './smartlog-interfaces.plugins';
|
|
|
|
|
2019-10-22 14:53:22 +00:00
|
|
|
import * as requestInterfaces from './smartlog-interfaces.requests';
|
|
|
|
|
2020-06-04 15:12:36 +00:00
|
|
|
export { requestInterfaces as request };
|
2019-10-22 14:53:22 +00:00
|
|
|
|
2018-11-07 17:39:30 +00:00
|
|
|
/**
|
|
|
|
* the different available log types
|
|
|
|
*/
|
|
|
|
export type TLogType =
|
|
|
|
| 'log'
|
|
|
|
| 'increment'
|
|
|
|
| 'gauge'
|
|
|
|
| 'error'
|
|
|
|
| 'success'
|
|
|
|
| 'value'
|
|
|
|
| 'finance'
|
2018-11-16 19:27:21 +00:00
|
|
|
| 'compliance';
|
2018-11-07 17:39:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* the available log levels
|
|
|
|
*/
|
2018-11-16 19:27:21 +00:00
|
|
|
export type TLogLevel =
|
|
|
|
| 'silly'
|
|
|
|
| 'info'
|
|
|
|
| 'debug'
|
|
|
|
| 'note'
|
|
|
|
| 'ok'
|
|
|
|
| 'success'
|
|
|
|
| 'warn'
|
|
|
|
| 'error'
|
|
|
|
| 'lifecycle';
|
2018-11-07 17:39:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* the available environments
|
|
|
|
*/
|
2018-03-01 21:33:47 +00:00
|
|
|
export type TEnvironment = 'local' | 'test' | 'staging' | 'production';
|
2018-11-07 17:39:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* the available runtimes
|
|
|
|
*/
|
2020-06-04 15:04:44 +00:00
|
|
|
export type TRuntime = 'node' | 'chrome' | 'rust' | 'deno';
|
2018-02-08 00:52:08 +00:00
|
|
|
|
2020-06-04 15:04:44 +00:00
|
|
|
/**
|
2020-06-04 15:12:36 +00:00
|
|
|
* the log context e.g. what app in what version on what server
|
2020-06-04 15:04:44 +00:00
|
|
|
*/
|
2018-02-08 00:52:08 +00:00
|
|
|
export interface ILogContext {
|
|
|
|
company?: string;
|
|
|
|
companyunit?: string;
|
|
|
|
containerName?: string;
|
|
|
|
environment: TEnvironment;
|
|
|
|
runtime: TRuntime;
|
2018-11-04 17:15:46 +00:00
|
|
|
zone: string;
|
2018-02-08 00:52:08 +00:00
|
|
|
}
|
|
|
|
|
2020-06-05 06:53:27 +00:00
|
|
|
export interface ILogCorrelation {
|
|
|
|
id: string;
|
2020-06-05 07:12:04 +00:00
|
|
|
type: 'none' | 'group' | 'build' | 'requestchain' | 'job';
|
2020-06-05 06:53:27 +00:00
|
|
|
}
|
|
|
|
|
2020-06-04 15:04:44 +00:00
|
|
|
/**
|
|
|
|
* the main logpackage
|
|
|
|
*/
|
|
|
|
export interface ILogPackage<T = unknown> {
|
|
|
|
/**
|
|
|
|
* a unix timestamp in milliseconds
|
|
|
|
*/
|
2018-11-04 17:15:46 +00:00
|
|
|
timestamp: number;
|
2018-11-03 22:02:58 +00:00
|
|
|
type: TLogType;
|
|
|
|
context: ILogContext;
|
|
|
|
level: TLogLevel;
|
2020-06-04 15:04:44 +00:00
|
|
|
/**
|
|
|
|
* allows grouping of log messages
|
|
|
|
*/
|
2020-06-05 06:53:27 +00:00
|
|
|
correlation: ILogCorrelation;
|
2020-06-05 01:15:46 +00:00
|
|
|
/**
|
|
|
|
* the message to log
|
|
|
|
*/
|
2018-03-01 21:33:47 +00:00
|
|
|
message: string;
|
2020-06-04 15:04:44 +00:00
|
|
|
data?: T;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ILogPackageDataRequest {
|
2020-06-05 01:15:46 +00:00
|
|
|
requestCorrelationId: string;
|
2020-06-04 15:04:44 +00:00
|
|
|
url: string;
|
|
|
|
pathname: string;
|
|
|
|
method: string;
|
|
|
|
status: string;
|
2018-02-28 23:32:21 +00:00
|
|
|
}
|
|
|
|
|
2018-10-31 12:49:12 +00:00
|
|
|
export interface ILogPackageAuthenticated {
|
|
|
|
auth: string;
|
|
|
|
logPackage: ILogPackage;
|
|
|
|
}
|
|
|
|
|
2020-06-04 15:04:44 +00:00
|
|
|
/**
|
|
|
|
* a destination interface for extending smartlog modules
|
|
|
|
*/
|
2018-02-28 23:32:21 +00:00
|
|
|
export interface ILogDestination {
|
2018-03-01 22:31:47 +00:00
|
|
|
handleLog: (logPackage: ILogPackage) => void;
|
2018-03-01 21:33:47 +00:00
|
|
|
}
|