Skip to content

Commit

Permalink
Merge pull request #1478 from okkez/add-log-concat-method
Browse files Browse the repository at this point in the history
Add `Fluent::Log#<<`
  • Loading branch information
repeatedly committed Mar 3, 2017
1 parent d4f92a5 commit 6fc58dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/fluent/log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ def puts(msg)
def write(data)
@out.write(data)
end
# We need `#<<` method to use this logger class with other
# libraries such as aws-sdk
alias << write

def flush
@out.flush
Expand Down
4 changes: 4 additions & 0 deletions test/test_log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ def test_write
@log.write("log")
end

def test_write_alias
assert(@log.respond_to?(:<<))
end

def test_out
assert_equal(@log.out, @logger.out)
@log.out = Object.new
Expand Down

0 comments on commit 6fc58dd

Please sign in to comment.