Can there be a way to disable logging?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- developer-experience
Research direction
Start from the exported Log object whose error(module, msg, isofile) calls isofile.onError; the request is a supported way to silence error-level output instead of reassigning Log.error, as the workaround does. See how Log is exported from the package entry point and where onError is invoked, then add a documented switch (a log level or quiet option) and cover it in the existing test suite. Done when a consumer can disable error logging through the public API without the monkey-patch shown here.
Written by the indexing model from the issue text.
Description
Based on current code, there's no way to disable logging of error level messages. This is my hacky workaround:
/**
* Suppress or restore Mp4Box error logging
* @param mp4box Mp4Box module
* @param quiet Whether to suppress error logging or restore original behaviour
*/
export function makeMp4BoxQuiet(mp4box: typeof import('mp4box'), quiet: boolean | undefined) {
if (quiet) {
(mp4box.Log as any).originalError = mp4box.Log.error;
mp4box.Log.error = (module: string, msg?: string, isofile?: ISOFile) => {
// This implementation is copied from mp4box source code
if (isofile?.onError) {
isofile.onError(module, msg ?? '');
}
};
} else {
const originalError = (mp4box.Log as any).originalError;
if (originalError) {
mp4box.Log.error = originalError;
}
}
}
I hope there's a better way to achieve this.
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 390
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 8
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from gpac/mp4box.js
-
mp4box.js — 20-byte `sgpd` box with large `entry_count` causes unbounded loop and heap OOM abortOpen
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 32/100
gpac/mp4box.js#551 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 40/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
Similar issues
-
The sample email preview's ResizeObserver is never disconnected and keeps raising errors after leaving SettingsPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
area:ui bug effort:S priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Typo in WSL project description on Projects pagePossibly taken @akhil9tiet claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 75/100
microsoft/opensource.microsoft.com#1066 · 1 comment ·
-
ArcGIS Maps SDK for JavaScript c-carousel calcite-design-tokens enhancement impact - p3 - not time sensitive needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Esri/calcite-design-system#15565 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
linkwarden/linkwarden#1891 ·
Maintainers usually reply within 1 day