Skip to content

Commit 13c3f10

Browse files
committed
Update README with logging ability
1 parent 6d8a86c commit 13c3f10

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ pdf[0].save('/path/to/image.png', {
8686
})
8787
```
8888

89+
Grim has limited logging abilities. The default logger is `Grim::NullLogger` but you can also set your own logger.
90+
91+
```ruby
92+
require "logger"
93+
Grim.logger = Logger.new($stdout).tap { |logger| logger.progname = 'Grim' }
94+
Grim.processor = Grim::ImageMagickProcessor.new({:ghostscript_path => "/path/to/bin/gs"})
95+
pdf = Grim.reap("/path/to/pdf")
96+
pdf[3].save('/path/to/image.png')
97+
# D, [2016-06-09T22:43:07.046532 #69344] DEBUG -- grim: Running imagemagick command
98+
# D, [2016-06-09T22:43:07.046626 #69344] DEBUG -- grim: PATH=/path/to/bin:/usr/local/bin:/usr/bin
99+
# D, [2016-06-09T22:43:07.046787 #69344] DEBUG -- grim: convert -resize 1024 -antialias -render -quality 90 -colorspace RGB -interlace none -density 300 /path/to/pdf /path/to/image.png
100+
```
101+
89102
## Reference
90103

91104
* [jonmagic.com: Grim](http://jonmagic.com/blog/archives/2011/09/06/grim/)

0 commit comments

Comments
 (0)