Skip to content

Commit 0b1861c

Browse files
committed
Unify code indent
1 parent c981755 commit 0b1861c

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ A structured event logger
1111
```ruby
1212
require 'fluent-logger'
1313

14-
log = Fluent::Logger::FluentLogger.new(nil, :host=>'localhost', :port=>24224)
15-
unless log.post("myapp.access", {"agent"=>"foo"})
14+
log = Fluent::Logger::FluentLogger.new(nil, :host => 'localhost', :port => 24224)
15+
unless log.post("myapp.access", {"agent" => "foo"})
1616
p log.last_error # You can get last error object via last_error method
1717
end
1818

@@ -24,8 +24,8 @@ end
2424
```ruby
2525
require 'fluent-logger'
2626

27-
log = Fluent::Logger::FluentLogger.new(nil, :socket_path => "/tmp/fluent.sock")
28-
unless log.post("myapp.access", {"agent"=>"foo"})
27+
log = Fluent::Logger::FluentLogger.new(nil, :socket_path => "/tmp/fluent.sock")
28+
unless log.post("myapp.access", {"agent" => "foo"})
2929
p log.last_error # You can get last error object via last_error method
3030
end
3131

@@ -36,8 +36,8 @@ end
3636
```ruby
3737
require 'fluent-logger'
3838

39-
Fluent::Logger::FluentLogger.open(nil, :host=>'localhost', :port=>24224)
40-
Fluent::Logger.post("myapp.access", {"agent"=>"foo"})
39+
Fluent::Logger::FluentLogger.open(nil, :host => 'localhost', :port => 24224)
40+
Fluent::Logger.post("myapp.access", {"agent" => "foo"})
4141

4242
# output: myapp.access {"agent":"foo"}
4343
```
@@ -46,8 +46,8 @@ Fluent::Logger.post("myapp.access", {"agent"=>"foo"})
4646
```ruby
4747
require 'fluent-logger'
4848

49-
log = Fluent::Logger::FluentLogger.new('myapp', :host=>'localhost', :port=>24224)
50-
log.post("access", {"agent"=>"foo"})
49+
log = Fluent::Logger::FluentLogger.new('myapp', :host => 'localhost', :port => 24224)
50+
log.post("access", {"agent" => "foo"})
5151

5252
# output: myapp.access {"agent":"foo"}
5353
```
@@ -72,7 +72,7 @@ f.warn("some application running.")
7272
```ruby
7373
require 'fluent-logger'
7474
f = Fluent::Logger::LevelFluentLogger.new('fluent')
75-
f.info("some_application"){"some application running."}
75+
f.info("some_application") {"some application running."}
7676
# output: fluent.info: {"level":"INFO","message":"some application running.","progname":"some_application"}
7777
```
7878

@@ -82,7 +82,7 @@ f.info("some_application"){"some application running."}
8282
require 'fluent-logger'
8383
f = Fluent::Logger::LevelFluentLogger.new('fluent')
8484
f.level = Logger::WARN
85-
f.info("some_application"){"some application running."}
85+
f.info("some_application") {"some application running."}
8686
```
8787

8888
Log level is ERROR so no output.
@@ -113,7 +113,7 @@ f.info("some_application"){"some application running."}
113113

114114
### Fluent
115115
```ruby
116-
Fluent::Logger::FluentLogger.open('tag_prefix', :host=>'localhost', :port=>24224)
116+
Fluent::Logger::FluentLogger.open('tag_prefix', :host => 'localhost', :port => 24224)
117117
```
118118

119119
### Console

lib/fluent/logger/fluent_logger.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class FluentLogger < LoggerBase
2929
RECONNECT_WAIT_INCR_RATE = 1.5
3030
RECONNECT_WAIT_MAX = 60
3131
RECONNECT_WAIT_MAX_COUNT =
32-
(1..100).inject(RECONNECT_WAIT_MAX / RECONNECT_WAIT) {|r,i|
32+
(1..100).inject(RECONNECT_WAIT_MAX / RECONNECT_WAIT) { |r, i|
3333
break i + 1 if r < RECONNECT_WAIT_INCR_RATE
3434
r / RECONNECT_WAIT_INCR_RATE
3535
}
@@ -61,7 +61,7 @@ def initialize(tag_prefix = nil, *args)
6161
@connect_error_history = []
6262

6363
@limit = options[:buffer_limit] || BUFFER_LIMIT
64-
@log_reconnect_error_threshold = options[:log_reconnect_error_threshold] || RECONNECT_WAIT_MAX_COUNT
64+
@log_reconnect_error_threshold = options[:log_reconnect_error_threshold] || RECONNECT_WAIT_MAX_COUNT
6565

6666
@buffer_overflow_handler = options[:buffer_overflow_handler]
6767
if logger = options[:logger]
@@ -136,6 +136,7 @@ def connection_string
136136
end
137137

138138
private
139+
139140
def to_msgpack(msg)
140141
begin
141142
msg.to_msgpack

spec/fluent_logger_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def flush(messages)
237237
@logger_io = StringIO.new
238238
logger = ::Logger.new(@logger_io)
239239
Fluent::Logger::FluentLogger.new('logger-test', {
240-
:socket_path => fluentd.socket_path,
240+
:socket_path => fluentd.socket_path,
241241
:logger => logger,
242242
:buffer_overflow_handler => buffer_overflow_handler
243243
})

spec/support/dummy_fluentd.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def initialize
1010
end
1111

1212
WAIT = ENV['WAIT'] ? ENV['WAIT'].to_f : 0.3
13-
SOCKET_PATH = ENV['SOCKET_PATH'] ? ENV['SOCKET_PATH'] : "/tmp/dummy_fluent.sock"
13+
SOCKET_PATH = ENV['SOCKET_PATH'] || "/tmp/dummy_fluent.sock"
1414

1515
def wait_transfer
1616
sleep WAIT
@@ -45,7 +45,7 @@ def output
4545

4646
def queue
4747
queue = []
48-
output.emits.each {|tag, time, record|
48+
output.emits.each { |tag, time, record|
4949
queue << [tag, record]
5050
}
5151
queue

0 commit comments

Comments
 (0)