Skip to content

Commit a897111

Browse files
committed
Improve jsdoc comments
1 parent ce13177 commit a897111

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

packages/logger/src/Logger.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,23 @@ class Logger extends Utility implements LoggerInterface {
170170
#jsonReplacerFn?: CustomJsonReplacerFn;
171171

172172
/**
173-
* isBufferEnabled represents whether the buffering functionality is enabled in the logger
173+
* Represents whether the buffering functionality is enabled in the logger
174174
*/
175175
protected isBufferEnabled = false;
176176

177177
/**
178-
* bufferLogThreshold represents the log level threshold for the buffer
178+
* Log level threshold for the buffer
179179
* Logs with a level lower than this threshold will be buffered
180180
*/
181181
protected bufferLogThreshold: number = LogLevelThreshold.DEBUG;
182182
/**
183-
* maxBufferBytesSize is the max size of the buffer. Additions to the buffer beyond this size will
183+
* Max size of the buffer. Additions to the buffer beyond this size will
184184
* cause older logs to be evicted from the buffer
185185
*/
186186
readonly #maxBufferBytesSize = 1024;
187187

188188
/**
189-
* buffer stores logs up to `maxBufferBytesSize`
189+
* Contains buffered logs, grouped by _X_AMZN_TRACE_ID, each group with a max size of `maxBufferBytesSize`
190190
*/
191191
readonly #buffer: CircularMap<string> = new CircularMap({
192192
maxBytesSize: this.#maxBufferBytesSize,
@@ -946,7 +946,7 @@ class Logger extends Utility implements LoggerInterface {
946946
}
947947

948948
/**
949-
* Print a given log with given log level.
949+
* Print or buffer a given log with given log level.
950950
*
951951
* @param logLevel - The log level threshold
952952
* @param input - The log message
@@ -1224,10 +1224,10 @@ class Logger extends Utility implements LoggerInterface {
12241224
}
12251225

12261226
/**
1227-
* bufferLogItem adds a log to the buffer
1228-
* @param xrayTraceId
1229-
* @param log
1230-
* @param logLevel
1227+
* Add a log to the buffer
1228+
* @param xrayTraceId - _X_AMZN_TRACE_ID of the request
1229+
* @param log - Log to be buffered
1230+
* @param logLevel - level of log to be buffered
12311231
*/
12321232
protected bufferLogItem(
12331233
xrayTraceId: string,
@@ -1246,9 +1246,8 @@ class Logger extends Utility implements LoggerInterface {
12461246
}
12471247

12481248
/**
1249-
* flushBuffer logs the items of the respective _X_AMZN_TRACE_ID within
1249+
* Flushes all items of the respective _X_AMZN_TRACE_ID within
12501250
* the buffer.
1251-
* @returns
12521251
*/
12531252
protected flushBuffer(): void {
12541253
const traceId = this.envVarsService.getXrayTraceId();
@@ -1271,12 +1270,14 @@ class Logger extends Utility implements LoggerInterface {
12711270
this.#buffer.delete(traceId);
12721271
}
12731272
/**
1274-
* shouldBufferLog returns true if the log meets the criteria to be buffered
1275-
* @param traceId _X_AMZN_TRACE_ID
1276-
* @param logLevel The level of the log being considered
1277-
* @returns
1273+
* Tests if the log meets the criteria to be buffered
1274+
* @param traceId - _X_AMZN_TRACE_ID of the request
1275+
* @param logLevel - The level of the log being considered
12781276
*/
1279-
shouldBufferLog(traceId: string | undefined, logLevel: number): boolean {
1277+
protected shouldBufferLog(
1278+
traceId: string | undefined,
1279+
logLevel: number
1280+
): boolean {
12801281
return (
12811282
this.isBufferEnabled &&
12821283
traceId !== undefined &&

0 commit comments

Comments
 (0)