Skip to content
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

Harmonize fixture logging #1601

Merged
merged 4 commits into from
Nov 3, 2023
Merged

Harmonize fixture logging #1601

merged 4 commits into from
Nov 3, 2023

Conversation

kstenerud
Copy link
Contributor

Goal

This PR harmonizes all of the logging in the CI fixtures so that they all use the same function names (logInfo, logWarn, logError) in Swift and Objective-C, and support optional varargs. These log functions all go to the same "channel" that prefixes bugsnagci <level> so that the fixture messages can easily be filtered by common tooling.

Copy link

github-actions bot commented Nov 2, 2023

Bugsnag.framework binary size did not change - 713,104 bytes

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [ = ]       0  [ = ]       0    TOTAL

Generated by 🚫 Danger

@@ -1,4 +1,5 @@
#import "Scenario.h"
#import "Logging.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to include the header in all the scenario files, when there are no other changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scenario.h is currently the bridging header, so anything it sees, Swift sees, which causes problems with the naming clash. We could try hoisting the things Swift needs out into another header file, but I ran out of time. I can look again later.

@@ -66,11 +67,11 @@ - (void)run {
- (void)consumeAllMemory {
struct utsname system = {0};
uname(&system);
NSLog(@"*** Device = %s", system.machine);
logInfo(@"*** Device = %s", system.machine);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my perspective, logs like these are too low-level to have the same prefix. What I'd really like to do is come to a device log and be able to quickly get a medium-level context of what's going on with the e2e tests. So (for me) these things are all really valid:

  • Launching the app
  • Finding reading the fixture config file
  • Polling for commands
  • Starting scenarios
  • etc

But things that are very scenario specific I would rather leave to normal logging, as not to dilute the power of being able to focus in on an area very quickly. Maybe we could have another standard prefix for the more detailed stuff?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add a "debug" channel for stuff like this...

@@ -218,28 +213,29 @@ + (void)clearPersistentData {
}

+ (void)executeMazeRunnerCommand:(void (^)(NSString *scenarioName, NSString *scenarioMode))preHandler {
NSLog(@"%s", __PRETTY_FUNCTION__);
logInfo(@"%s", __PRETTY_FUNCTION__);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for me here - worthy of logging, for sure, but breaks the level of abstraction that I had been aiming for.

@twometresteve twometresteve merged commit eb6bb90 into next Nov 3, 2023
37 checks passed
@twometresteve twometresteve deleted the karl-mazerunner-logging branch November 3, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants