Skip to content

Commit 8f22a50

Browse files
committed
allow user to override logger
1 parent e2afd5a commit 8f22a50

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ Plants.token = 'your token here'
1111
Plants.list_plants # ...
1212
```
1313

14+
If you wish to override the log:
15+
```ruby
16+
Plants::Log.instance = logger # Your logger here
17+
```
18+
1419
### Endpoints
1520
All methods return an instance of [`HTTP::Response`](https://github.com/httprb/http/wiki/Response-Handling)
1621

lib/plants/log.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ class << self
4848
def instance
4949
@_instance ||= new
5050
end
51+
52+
# @param other_logger [#debug, #info, #warn, #error, #fatal]
53+
# @return [void]
54+
def instance=(other_logger)
55+
@_instance = other_logger
56+
end
5157
end
5258
end
5359
end

lib/plants/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
module Plants
44
# @return [String]
5-
VERSION = "0.1.0"
5+
VERSION = "0.2.0"
66
end

0 commit comments

Comments
 (0)