@@ -19,7 +19,11 @@ package com.twitter.logging
19
19
import com .twitter .conversions .DurationOps ._
20
20
import com .twitter .io .TempFolder
21
21
import java .net .InetSocketAddress
22
- import java .util .concurrent .{Callable , CountDownLatch , Executors , Future , TimeUnit }
22
+ import java .util .concurrent .Callable
23
+ import java .util .concurrent .CountDownLatch
24
+ import java .util .concurrent .Executors
25
+ import java .util .concurrent .Future
26
+ import java .util .concurrent .TimeUnit
23
27
import java .util .{logging => javalog }
24
28
import org .scalatest .BeforeAndAfter
25
29
import scala .collection .mutable
@@ -68,7 +72,7 @@ class LoggerTest extends AnyWordSpec with TempFolder with BeforeAndAfter {
68
72
logger.addHandler(traceHandler)
69
73
}
70
74
71
- def logLines (): Seq [String ] = traceHandler.get.split(" \n " )
75
+ def logLines (): Seq [String ] = traceHandler.get.split(" \n " ).toIndexedSeq
72
76
73
77
/**
74
78
* Verify that the logger set up with `traceLogger` has received a log line with the given
@@ -124,7 +128,7 @@ class LoggerTest extends AnyWordSpec with TempFolder with BeforeAndAfter {
124
128
" asdf" + executed + " hi there"
125
129
}
126
130
127
- logger.debugLazy(function)
131
+ logger.debugLazy(function() )
128
132
assert(! executed)
129
133
}
130
134
@@ -136,7 +140,7 @@ class LoggerTest extends AnyWordSpec with TempFolder with BeforeAndAfter {
136
140
executed = true
137
141
" asdf" + executed + " hi there"
138
142
}
139
- logger.debugLazy(function)
143
+ logger.debugLazy(function() )
140
144
assert(executed)
141
145
}
142
146
@@ -263,11 +267,11 @@ class LoggerTest extends AnyWordSpec with TempFolder with BeforeAndAfter {
263
267
val otherFactories = List (LoggerFactory (node = " " , level = Some (Level .INFO )))
264
268
Logger .configure(initialFactories)
265
269
266
- assert(Logger .get(" " ).getLevel == Level .DEBUG )
270
+ assert(Logger .get(" " ).getLevel() == Level .DEBUG )
267
271
Logger .withLoggers(otherFactories) {
268
272
assert(Logger .get(" " ).getLevel() == Level .INFO )
269
273
}
270
- assert(Logger .get(" " ).getLevel == Level .DEBUG )
274
+ assert(Logger .get(" " ).getLevel() == Level .DEBUG )
271
275
}
272
276
273
277
" configure logging" should {
@@ -294,13 +298,13 @@ class LoggerTest extends AnyWordSpec with TempFolder with BeforeAndAfter {
294
298
) :: Nil
295
299
).apply()
296
300
297
- assert(log.getLevel == Level .DEBUG )
301
+ assert(log.getLevel() == Level .DEBUG )
298
302
assert(log.getHandlers().length == 1 )
299
303
val handler = log.getHandlers()(0 ).asInstanceOf [FileHandler ]
300
304
val fileName = folderName + separator + " test.log"
301
305
assert(handler.filename == fileName)
302
306
assert(handler.append == false )
303
- assert(handler.getLevel == Level .INFO )
307
+ assert(handler.getLevel() == Level .INFO )
304
308
val formatter = handler.formatter
305
309
assert(
306
310
formatter.formatPrefix(javalog.Level .WARNING , " 10:55" , " hello" ) == " WARNING 10:55 hello"
@@ -325,7 +329,7 @@ class LoggerTest extends AnyWordSpec with TempFolder with BeforeAndAfter {
325
329
) :: Nil
326
330
).apply()
327
331
328
- assert(log.getHandlers.length == 1 )
332
+ assert(log.getHandlers() .length == 1 )
329
333
val h = log.getHandlers()(0 ).asInstanceOf [SyslogHandler ]
330
334
assert(h.dest.asInstanceOf [InetSocketAddress ].getHostName == " localhost" )
331
335
assert(h.dest.asInstanceOf [InetSocketAddress ].getPort == 212 )
@@ -365,9 +369,9 @@ class LoggerTest extends AnyWordSpec with TempFolder with BeforeAndAfter {
365
369
) :: Nil
366
370
367
371
Logger .configure(factories)
368
- assert(Logger .get(" " ).getLevel == Level .INFO )
369
- assert(Logger .get(" w3c" ).getLevel == Level .OFF )
370
- assert(Logger .get(" bad_jobs" ).getLevel == Level .INFO )
372
+ assert(Logger .get(" " ).getLevel() == Level .INFO )
373
+ assert(Logger .get(" w3c" ).getLevel() == Level .OFF )
374
+ assert(Logger .get(" bad_jobs" ).getLevel() == Level .INFO )
371
375
try {
372
376
Logger .get(" " ).getHandlers()(0 ).asInstanceOf [ThrottledHandler ]
373
377
} catch {
0 commit comments