Skip to content

Application Log Statements Output#29

Open
paulstringer wants to merge 18 commits intomasterfrom
App-Logging-To-File
Open

Application Log Statements Output#29
paulstringer wants to merge 18 commits intomasterfrom
App-Logging-To-File

Conversation

@paulstringer
Copy link
Copy Markdown
Owner

@paulstringer paulstringer commented Aug 4, 2018

Adds support for the following logging behaviour:

Supported Logging commands:

OS X

  • NSLog, print()

iOS

  • NSLog, os_log()

Logs are captured to Fitnesses's own execution log and written to file in the local project root in Logs/.log

Implementation Details:

The iOS implementation captures the logs from the simulator after the simulator app exists using the simctl spawn booted log show command.

OSX simply redirects output from stderr/stdout when executing the app to a logfile.

Empty logs are deleted if zero lines are detected.

Documentation and an example of logging has been added to the Fitnesse example.

Copy link
Copy Markdown
Collaborator

@mabidakun mabidakun left a comment

Choose a reason for hiding this comment

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

Great work. 👍🏾

if #available(OSX 10.12, *) {
os_log("*WARNING* os_log() statements not captured on OS X")
} else {
// Fallback on earlier versions
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Need to do something here?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Removed the else. It is for example only.

echo $LOGFILE
}

tidy_zero_line_app_log_file(){
Copy link
Copy Markdown
Collaborator

@mabidakun mabidakun Aug 4, 2018

Choose a reason for hiding this comment

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

I don't think this is necessary.
The log should always contain something (e.g. start_slim() would write something), no?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Logs now always generate some head and tail output. Files not deleted 👍

!1 OCSlimProject Example Test Page

Below is a simple Decision Table based Acceptance Test. It sends input to an instance of a Fixture which is implemented in your Xcode project. This is done by adding a class of the same name e.g. 'FixtureExample.swift' to your Acceptance Test target.
Below is a simple Decision Table based Acceptance Test. It sends input to an instance of a Fixture which is implemented in your Xcode project. This is done by adding a class of the same name e.g. 'FixtureExample.swift' to your Acceptance Test target.
Copy link
Copy Markdown
Collaborator

@mabidakun mabidakun Aug 4, 2018

Choose a reason for hiding this comment

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

Great introductory comment to re-inforce information that is hard to grok if you don't really understand how it all works.

…utputting something- Improve consistency/readability of ocsp logging
Copy link
Copy Markdown
Collaborator

@mabidakun mabidakun left a comment

Choose a reason for hiding this comment

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

👍🏾

@paulstringer
Copy link
Copy Markdown
Owner Author

Updated to no longer delete log files as logs are always created.

Your thoughts on if a unique log file should be generated for each run (as it is now) or wether it should overwrite each run with a global log e.g. 'system_under_test.log' OR append to one big global log file each run.

I'm questioning the value of a log file once you've moved onto the next one and the maintenance work being asked of the user.

@dcutting
Copy link
Copy Markdown
Collaborator

dcutting commented Aug 7, 2018

👍 for this PR. Regarding log files, I think you should just overwrite the same log each run (and possibly allow the user to specify a log name on the command line). Otherwise people will have to spend time deleting logs, or accidentally checking in a lot of rubbish to git.

@mabidakun
Copy link
Copy Markdown
Collaborator

mabidakun commented Aug 7, 2018

@paulstringer - I agree with @dcutting .

You should overwrite to the same log filename (added to .gitignore), as this will make its use, scriptable.
As each run is anew - you'd probably not want the confusion caused by having data from previous runs.

@paulstringer
Copy link
Copy Markdown
Owner Author

Thanks guys. I'll update the PR to use the suggested behaviour. Log will overwrite to $PROJECT_DIR/ocslimproject_app.log with a user specifiable log file name.

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.

3 participants