Skip to content

Commit

Permalink
docs, remove unneeded \ and remove trailing whitespace. [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
senny committed Jul 16, 2014
1 parent 9e5cab2 commit 2bba2e1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions guides/source/debugging_rails_applications.md
Expand Up @@ -210,7 +210,7 @@ logger.tagged("BCX") { logger.tagged("Jason") { logger.info "Stuff" } } # Logs "
```

### Impact of Logs on Performance
Logging will always have a small impact on performance of your rails app,
Logging will always have a small impact on performance of your rails app,
particularly when logging to disk.However, there are a few subtleties:

Using the `:debug` level will have a greater performance penalty than `:fatal`,
Expand All @@ -224,20 +224,20 @@ Another potential pitfall is that if you have many calls to `Logger` like this
logger.debug "Person attributes hash: #{@person.attributes.inspect}"
```

In the above example, There will be a performance impact even if the allowed
output level doesn't include debug. The reason is that Ruby has to evaluate
these strings, which includes instantiating the somewhat heavy `String` object
In the above example, There will be a performance impact even if the allowed
output level doesn't include debug. The reason is that Ruby has to evaluate
these strings, which includes instantiating the somewhat heavy `String` object
and interpolating the variables, and which takes time.
Therefore, it's recommended to pass blocks to the logger methods, as these are
only evaluated if the output level is the same or included in the allowed level
Therefore, it's recommended to pass blocks to the logger methods, as these are
only evaluated if the output level is the same or included in the allowed level
(i.e. lazy loading). The same code rewritten would be:

```ruby
logger.debug {"Person attributes hash: #{@person.attributes.inspect}"}
```

The contents of the block, and therefore the string interpolation, is only
evaluated if debug is enabled. This performance savings is only really
The contents of the block, and therefore the string interpolation, is only
evaluated if debug is enabled. This performance savings is only really
noticeable with large amounts of logging, but it's a good practice to employ.

Debugging with the `debugger` gem
Expand Down Expand Up @@ -284,7 +284,7 @@ $ rails server --debugger
...
```

TIP: In development mode, you can dynamically `require \'debugger\'` instead of restarting the server, even if it was started without `--debugger`.
TIP: In development mode, you can dynamically `require 'debugger'` instead of restarting the server, even if it was started without `--debugger`.

### The Shell

Expand Down

0 comments on commit 2bba2e1

Please sign in to comment.