-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When using the iOS PrintLoggerPlugin:
- Logs from the
applyof core plugins will be ignored unless they are in a hook. - All logs will incorrectly use the plugin's log level (i.e.
PrintLoggerPlugin(level: .trace)) instead of their intended level. E.g. this log:is showing up as "trace" even though it's "debug":player.logger.debug('[REPRO] [CORE] In view hook');
[Player] [trace]: [[REPRO] [CORE] In view hook]
To Reproduce
- Use this branch
- Run the demo. Filter console output by "repro". Observe the logs. You should see these logs:
[Player] [trace]: ["[REPRO] Entered ReproPlugin"]
[Player] [trace]: ["[REPRO] Exiting ReproPlugin"]
[Player] [trace]: [[REPRO] [CORE] In view hook]
[Player] [trace]: ["[REPRO] In view hook"]
[Player] [trace]: ["[REPRO] In view hook"]
[Player] [trace]: ["[REPRO] In view hook"]
There are 2 logs missing, marked with comments here on the branch.
Expected behavior
I expect the actual log level to be reflected, i.e. debug instead of trace. I also expect the log messages from the core apply to actually show up.
I expect to see these logs:
[Player] [debug]: [[REPRO] [CORE] ReproPlugin entered]
[Player] [debug]: [[REPRO] [CORE] ReproPlugin exited]
[Player] [debug]: ["[REPRO] Entered ReproPlugin"]
[Player] [debug]: ["[REPRO] Exiting ReproPlugin"]
[Player] [debug]: [[REPRO] [CORE] In view hook]
[Player] [debug]: ["[REPRO] In view hook"]
[Player] [debug]: ["[REPRO] In view hook"]
[Player] [debug]: ["[REPRO] In view hook"]
Environment:
- iPhone 16, iOS 18.5 simulator
- Xcode 16.4
Additional context
Suspected cause of ignored logs
The logs are ignored because the PrintLoggerPlugin is not a JSBasePlugin and is applied after the JSBasePlugins. This means that the log methods have not actually been added by the time that the apply of the core is called. Here/here is where the JSBasePlugins are loaded. Then later, the native plugins are applied too.
Suspected cause of logLevel issue
This is using the log level of the plugin instead of the calling function.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working