MCPcopy Index your code
hub / github.com/scality/cloudserver / constructor

Method constructor

lib/utilities/serverAccessLogger.js:11–38  ·  view source on GitHub ↗
(filename, highWaterMarkBytes, retryReopenDelayMS, checkFileRotationIntervalMS)

Source from the content-addressed store, hash-verified

9
10class ServerAccessLogger {
11 constructor(filename, highWaterMarkBytes, retryReopenDelayMS, checkFileRotationIntervalMS) {
12 this._filename = filename;
13 this._highWaterMarkBytes = highWaterMarkBytes;
14 this._retryReopenDelayMS = retryReopenDelayMS;
15 this._stat = undefined;
16 this._waitingDrain = false;
17 this._terminated = false;
18 this._reopenStream();
19
20 setInterval(() => { this._checkFileRotated(); }, checkFileRotationIntervalMS);
21
22 process.on('beforeExit', () => {
23 this._cleanOldStream(true);
24 this._terminated = true;
25 });
26 process.on('SIGINT', () => {
27 this._cleanOldStream(true);
28 this._terminated = true;
29 });
30 process.on('SIGTERM', () => {
31 this._cleanOldStream(true);
32 this._terminated = true;
33 });
34 process.on('uncaughtException', () => {
35 this._cleanOldStream(true);
36 this._terminated = true;
37 });
38 }
39
40 _checkFileRotated() {
41 logger.debug('ServerAccessLogger: check file rotation');

Callers

nothing calls this directly

Calls 3

_reopenStreamMethod · 0.95
_checkFileRotatedMethod · 0.95
_cleanOldStreamMethod · 0.95

Tested by

no test coverage detected