snaplogger
Version:
A snap per time logger! And notifier! Or snap hooker! Make snap to be taken at interval! And take action on! Can be used for snap logging! Or notifying! Or Snap action!
47 lines (46 loc) • 1.42 kB
TypeScript
import { Snap, IOptions as ISnapOptions } from './Snap';
export interface IOptions extends ISnapOptions {
intervalTime?: number;
}
export declare enum ERunningState {
Running = 1,
CompletelyStopped = 2,
LoggingOnlyStopped = 3
}
export interface IStartData {
logImmediately?: boolean;
logImmediatelyOptions?: ILogData;
}
export interface ILogData {
dateTime?: number;
}
export declare class SnapLogger {
snap: Snap;
private _timeIntervalHandler;
private _intervalTime;
private _runningState;
private _isAnythingSet;
constructor(options: IOptions);
set(key: string, val: any): this;
getSnapMap(): Map<string, any>;
log(data?: ILogData): this;
/**
* Start the SnapLogger! Both setting to the snapshot is open and Logging
*
* @returns {this}
* @memberof SnapLogger
*/
start(data?: IStartData): this;
/**
* Stop the SnapLogger! Defaulting to stopping only logging (not locking the set to snap)!
*
* If it makes sense to you! To not write to the snap! You can set stopState to ERunningState.
* CompletelySopped! That will allow better performance (writes to map skipped!)
* (The value of this depends of your app!)
*
* @param {ERunningState} [stopState=ERunningState.LoggingOnlyStopped]
* @returns {this}
* @memberof SnapLogger
*/
stop(stopState?: ERunningState): this;
}