Skip to content

Commit 01db5dd

Browse files
authored
adds logs guidance for new bug reports (#2004)
* adds logs guidance for new bug reports
1 parent 4aa0e22 commit 01db5dd

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ body:
9292
label: Relevant log output
9393
description: >-
9494
Include any relevant log output under
95-
`~/.amplify/logs/amplify-cli-<issue-date>.log`
95+
`~/.amplify/logs/amplify-cli-<issue-date>.log` (See: [Logs Guidance](https://github.com/aws-amplify/amplify-ios/blob/main/LogsGuidance.md))
96+
placeholder: |
97+
<details>
98+
<summary>Log Messages</summary>
99+
100+
```
101+
INSERT LOG MESSAGES HERE
102+
```
103+
</details>
96104
render: shell
97105
- type: dropdown
98106
id: regression

LogsGuidance.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Logs Guidance
2+
3+
When providing logs in an issue please follow these recommendations.
4+
5+
1. Use an editor to clear out any sensitive information.
6+
2. Remove lines which are not relevant to the problem.
7+
3. Place the logs in the markdown syntax below.
8+
9+
## Screenshots vs Text Logs
10+
11+
Sharing logs as text will make it possible to search for log messages across issues and to trim logs to the relevant details. Collect logs from Xcode Console or the Console app by highlighting lines and copying them to an editor where the text can be prepared for sharing in a new issue.
12+
13+
### Stack Frames
14+
15+
To collect details about the stack frames while debugging, also copy lines from the Xcode Debug Navigator by selecting the stack frames and copying the text to an editor. Showing stack frames shows the backtrace of function calls which is helpful in understanding the context. You can also set a breakpoint which will run a Debugger Command such as `bt 5` which will print 5 of the backtrace from that point where the breakpoint is set. This text will appear in the Xcode Console where it can be copied with other log messages to provide useful context for resolving the issue.
16+
17+
1. Add a breakpoint to where you want to include more context
18+
2. Edit the breakpoint and select the checkbox at the bottom to automatically continue
19+
3. Add an Action which will be a Debugger Command
20+
4. Add `bt 5` to print the last 5 lines of the backtrace to the console
21+
5. Optionally also add action to log a message which can include an expression
22+
23+
Like the watch window displayed while debugging, a log message from a breakpoint can evalulate an expression to print out those details in the Xcode console. For a variable named `info`, simply add `@info@` to the log message text field. You may want to add debugging features to your code which can provide a string or dictionary which provides useful information which can be used when logging from a breakpoint.
24+
25+
## Sensitive Information
26+
27+
Logs should be trimmed of details which should not be shared publicly, such as user names and credentials. Use an editor to find references using either a keyword search or regular expression and either delete that information or replace it with placeholder text if it helps provide context.
28+
29+
## Collapsible details in markdown
30+
31+
Including a lot of log messages in a GitHub issue is helpful but also requires a lot of scrolling. It can be difficult to also copy that log to an editor to filter to the most useful details. GitHub markdown supports collapsing details with the syntax below. It is just the `<details>` tags which must include a `<summary>` tag at the start.
32+
33+
Beyond just making it possible to collapse the details, n button appears at the top right when it is expanded to let you copy to your clipboard making it easy to bring it to an editor.
34+
35+
````markdown
36+
<details>
37+
<summary>Log Messages</summary>
38+
39+
```
40+
INSERT LOG MESSAGES HERE
41+
```
42+
</details>
43+
````

0 commit comments

Comments
 (0)