-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new-log-viewer: Define interface for filtering by log level and add support (internally) to JsonlDecoder; Move timestamp field extraction from LogbackFormatter to JsonlDecoder. #79
Changes from all commits
62a69c7
f409855
3343510
434f2f8
33da060
e5b6abe
2ecd5b1
477fe23
17c281a
da61b98
f3cb5b4
4159305
01e4723
dc9e533
114af1d
a2814e4
b562c34
5af877a
8ce2a83
4bf08dc
8d38166
81389df
3777537
5933c37
637d488
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -4,8 +4,11 @@ import {Nullable} from "../../typings/common"; | |||||||
import { | ||||||||
Decoder, | ||||||||
DecodeResultType, | ||||||||
FilteredLogEventMap, | ||||||||
LOG_EVENT_FILE_END_IDX, | ||||||||
LogEventCount, | ||||||||
} from "../../typings/decoders"; | ||||||||
import {LogLevelFilter} from "../../typings/logs"; | ||||||||
|
||||||||
|
||||||||
class ClpIrDecoder implements Decoder { | ||||||||
|
@@ -31,19 +34,42 @@ class ClpIrDecoder implements Decoder { | |||||||
return this.#streamReader.getNumEventsBuffered(); | ||||||||
} | ||||||||
|
||||||||
buildIdx (beginIdx: number, endIdx: number): Nullable<LogEventCount> { | ||||||||
// eslint-disable-next-line class-methods-use-this | ||||||||
getFilteredLogEventMap (): FilteredLogEventMap { | ||||||||
// eslint-disable-next-line no-warning-comments | ||||||||
// TODO: Update this after log level filtering is implemented in clp-ffi-js | ||||||||
console.error("Not implemented."); | ||||||||
|
||||||||
return null; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be better if we make the log-level filtering a no-op rather than completely disabling the decoder?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I put in the console error but not the return value. If the value is null, the new plan is it will just not use the filter, so it is okay to return null. |
||||||||
} | ||||||||
|
||||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this | ||||||||
setLogLevelFilter (logLevelFilter: LogLevelFilter): boolean { | ||||||||
// eslint-disable-next-line no-warning-comments | ||||||||
// TODO: Update this after log level filtering is implemented in clp-ffi-js | ||||||||
console.error("Not implemented."); | ||||||||
|
||||||||
return false; | ||||||||
davemarco marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
} | ||||||||
|
||||||||
build (): LogEventCount { | ||||||||
return { | ||||||||
numInvalidEvents: 0, | ||||||||
numValidEvents: this.#streamReader.deserializeRange(beginIdx, endIdx), | ||||||||
numValidEvents: this.#streamReader.deserializeRange(0, LOG_EVENT_FILE_END_IDX), | ||||||||
}; | ||||||||
} | ||||||||
|
||||||||
// eslint-disable-next-line class-methods-use-this | ||||||||
setDecoderOptions (): boolean { | ||||||||
setFormatterOptions (): boolean { | ||||||||
return true; | ||||||||
} | ||||||||
|
||||||||
decode (beginIdx: number, endIdx: number): Nullable<DecodeResultType[]> { | ||||||||
decodeRange ( | ||||||||
beginIdx: number, | ||||||||
endIdx: number, | ||||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||||||||
useFilter: boolean | ||||||||
davemarco marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
): Nullable<DecodeResultType[]> { | ||||||||
return this.#streamReader.decodeRange(beginIdx, endIdx); | ||||||||
} | ||||||||
} | ||||||||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider enhancing error handling for invalid events
While logging invalid events using
console.error
aids in debugging, it might be beneficial to implement a more robust error-handling mechanism. This could include counting invalid events, aggregating them for reporting, or providing feedback to the user if a significant number are encountered.