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 authored Feb 21, 2017
2 parents 7719591 + 22b590e commit 0886030
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 @@ -357,6 +357,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 @@ -720,6 +720,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 0886030

Please sign in to comment.