Add log output through copy of client sdk logging infrastructure#109
Add log output through copy of client sdk logging infrastructure#109
Conversation
🦋 Changeset detectedLatest commit: f1d3fb2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…n instantiating its own
|
Per discussion with @lukasIO, I updated this change to tap into the logging infrastructure from the main client sdk package rather than instantiate a full new logging stack. |
xianshijing-lk
left a comment
There was a problem hiding this comment.
One small question. lgtm on the rest
| const logLevel = LogLevel[methodName as LogLevelString]; | ||
| const needLog = logLevel >= configLevel && logLevel < LogLevel.silent; | ||
|
|
||
| return (msg, context?: [msg: string, context: object]) => { |
There was a problem hiding this comment.
just want to double check since I am not familiar with the high level use cases yet, should context be a optional object ? or tuple that contains the msg and context ?
There was a problem hiding this comment.
I'll admit I copied this code from here, and I'm unfamiliar with the specific details of why it was done the way it was done.
Taking a guess though, in https://github.com/pimterry/loglevel#writing-plugins, it seems like maybe the context isn't always included / only injected sometimes based off the log message?
Adds a copy of src/logger.ts from the client sdk to this package, and wires up all logs to go through this logger implementation rather than via
console.One important caveat: logs from the mediapipe webworker aren't going through this logging infrastructure right now. Poking around in a debugger, it does look like there's a way to swap out
console.logat the emscripten level but mediapipe abstracts over that interface in a way where it doesn't really look like there's any way to inject some custom logging implementation without fully forking mediapipe, which IMO probably isn't worth it for this. Related: google-ai-edge/mediapipe#4991