Skip to main content

Reading App Logs

Pro plan or higher required Build errors show problems at compile time. But what about issues that happen while your app is running? That’s where app logs come in.

What Are App Logs?

Logs are messages your app produces while running. They show:
  • What code is executing
  • Values of variables
  • Errors that occur at runtime
  • User actions and their effects

Accessing Logs in Nativeline

1

Open the Code Editor

Click the Code Editor tab in the Nativeline interface.
2

Switch to Logs View

Find and click the Logs tab or section within the Code Editor.
3

Run Your App

Build and run your app. Logs appear in real-time.
4

Watch the Output

As you interact with your app, logs show what’s happening.

Understanding Log Output

Basic Log Structure

2024-01-15 10:30:45.123 MyApp[12345:67890] Save button tapped
2024-01-15 10:30:45.456 MyApp[12345:67890] Saving data: User(name: "John")
2024-01-15 10:30:45.789 MyApp[12345:67890] Save completed successfully
Each line shows:
  • Timestamp: When it happened
  • App name: Which app
  • Message: The actual log content

Log Types

TypeMeaning
Info logsNormal operation, status updates
Warning logsSomething unusual, but not critical
Error logsSomething went wrong
Debug logsDeveloper debugging info

Adding Logs to Your App

Ask the AI to add logging:

For Debugging a Specific Feature

Add print statements to the saveData function to show:
- When the function starts
- What data is being saved
- Whether the save succeeded or failed

For Tracking User Actions

Add logging for all button taps so I can see what users are doing

For API/Network Issues

Add logging to show:
- When API requests start
- What data is being sent
- What response comes back
- Any errors that occur

Common Debugging Scenarios

Debugging “Nothing Happens” Issues

Your button doesn’t seem to work? Add logs:
Add a print statement at the start of the button's action
to confirm it's being triggered
If the log appears: The button works, the issue is in the code after. If no log appears: The button isn’t connected properly.

Debugging Data Issues

Data not showing up?
Add logging to show:
- When data is loaded
- How many items were loaded
- The actual content of the first item
Check the logs to see if data exists and what it contains.

Debugging Navigation Issues

Screen not appearing?
Add logging when the navigation to [screen] is triggered
and when [screen] appears
Follow the trail to see where it breaks.

Debugging Crash-Like Behavior

App freezing or behaving strangely?
Add extensive logging throughout [feature] to trace exactly
where the problem occurs
The last log before the freeze indicates where to look.

Reading Swift Error Messages

When Swift errors appear in logs, they often include useful info:

Optional Unwrapping Errors

Fatal error: Unexpectedly found nil while unwrapping an Optional value
Meaning: Your code tried to use a nil value that should have had a value. Fix: Ask the AI to add nil checking for the relevant variable.

Array Index Errors

Fatal error: Index out of range
Meaning: Accessing an array position that doesn’t exist. Fix: Check array bounds before accessing, or verify the data exists.

Type Casting Errors

Could not cast value of type 'X' to 'Y'
Meaning: Tried to convert between incompatible types. Fix: Check the actual type and handle it appropriately.

Effective Logging Strategies

1. Log Entry and Exit

print("▶️ saveProfile started")
// ... code ...
print("✅ saveProfile completed")
This shows whether functions complete or exit early.

2. Log Important Values

print("📊 User data: \(userData)")
print("📊 Items count: \(items.count)")
See what your variables actually contain.

3. Log Decision Points

if isLoggedIn {
    print("🔓 User is logged in, showing profile")
} else {
    print("🔒 User not logged in, showing login")
}
Understand which code paths execute.

4. Use Distinctive Markers

Using emojis or prefixes makes logs easier to scan:
  • ▶️ Start of function
  • Success
  • Error
  • ⚠️ Warning
  • 📊 Data values
  • 🔄 State changes

Filtering and Searching Logs

When there’s a lot of output:

Search for Specific Text

Look for your custom log messages or error keywords.

Filter by Feature

If you’re debugging the save feature, search for “save” in logs.

Filter by Error Level

Look for “error”, “failed”, “nil”, or “crash” to find problems.

When to Use Logs vs Build Errors

SituationCheck
App won’t compileBuild errors in chat
App compiles but crashesRuntime logs
App runs but feature doesn’t workRuntime logs
UI looks wrongVisual inspection + logs
Data doesn’t saveLogs showing save operations
API not workingLogs showing requests/responses

Removing Debug Logs

Before publishing your app, clean up debug logs:
Remove all the debug print statements we added for troubleshooting.
Keep only important error logging.
Or for more control:
Replace debug print statements with proper logging that only
shows in debug builds, not in production.

Advanced: Console.app

For even more detailed debugging, you can use macOS’s Console app:
  1. Open Console.app (in Applications → Utilities)
  2. Select your Simulator in the sidebar
  3. Run your app
  4. See comprehensive system logs
This shows logs from iOS itself, not just your app.

Troubleshooting

  • Make sure your app is running
  • Check you’re on the Logs tab
  • Try adding explicit print statements
  • Restart the Simulator
  • Add distinctive prefixes to your logs
  • Search for specific terms
  • Ask the AI to reduce logging: “Only log errors, not normal operations”
The Logs feature requires Pro plan or higher. Check your subscription in Settings.

Next Steps