Describe the bug
When using the iOS PrintLoggerPlugin:
- Logs from the
apply of 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:
player.logger.debug('[REPRO] [CORE] In view hook');
is showing up as "trace" even though it's "debug":
[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.
Describe the bug
When using the iOS
PrintLoggerPlugin:applyof core plugins will be ignored unless they are in a hook.PrintLoggerPlugin(level: .trace)) instead of their intended level. E.g. this log:To Reproduce
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.
debuginstead oftrace. I also expect the log messages from the coreapplyto actually show up.I expect to see these logs:
Environment:
Additional context
Suspected cause of ignored logs
The logs are ignored because the
PrintLoggerPluginis not aJSBasePluginand is applied after theJSBasePlugins. This means that the log methods have not actually been added by the time that theapplyof the core is called. Here/here is where theJSBasePluginsare 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.