Skip to content

Commit 7740dfa

Browse files
authored
Remove filter (#3)
1 parent 1f6aee1 commit 7740dfa

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

src/LoggingZMQ.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,23 @@ The logger is **not** thread safe because ZMQ sockets are not thread safe.
1919
struct ZMQLogger <: Logging.AbstractLogger
2020
sock::ZMQ.Socket
2121
lock::ReentrantLock
22-
min_level::Base.CoreLogging.LogLevel
2322
message_limits::Dict{Any, Int}
2423
end
2524

26-
function ZMQLogger(sock, min_level, message_limits)
27-
return ZMQLogger(sock, ReentrantLock(), min_level, message_limits)
25+
function ZMQLogger(sock, message_limits)
26+
return ZMQLogger(sock, ReentrantLock(), message_limits)
2827
end
2928

30-
function ZMQLogger(sock, min_level = Logging.Info)
31-
return ZMQLogger(sock, ReentrantLock(), min_level, Dict{Any, Int}())
29+
function ZMQLogger(sock)
30+
return ZMQLogger(sock, Dict{Any, Int}())
3231
end
3332

3433
function Logging.min_enabled_level(logger::ZMQLogger)
35-
return logger.min_level
34+
return Logging.BelowMinLevel
3635
end
3736

3837
function Logging.shouldlog(logger::ZMQLogger, level, _module, group, id)
39-
return @lock logger.lock get(logger.message_limits, id, 1) > 0
38+
return true
4039
end
4140

4241
function Logging.catch_exceptions(::ZMQLogger)

test/runtests.jl

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ end
5454

5555
logsock = Socket(ctx, PUB)
5656
bind(logsock, log_addr)
57-
logger = ZMQLogger(logsock, Logging.BelowMinLevel)
57+
logger = ZMQLogger(logsock)
5858

5959
# Wait until receiver indicates ok to start
6060
trigger = Socket(ctx, REP)
@@ -71,21 +71,4 @@ end
7171

7272
@spawn timeout(timeout_sec, c)
7373
@test take!(c) == "Ok"
74-
75-
c = Channel{String}(32)
76-
test_task = spawn_receiver(ctx, ["Error", "Warning"], c)
77-
logger = ZMQLogger(logsock, Logging.Warn)
78-
79-
# Wait until receiver indicates ok to start
80-
recv(trigger)
81-
send(trigger, "Ok")
82-
83-
Logging.with_logger(logger) do
84-
Logging.@error "Error"
85-
Logging.@warn "Warning"
86-
Logging.@info "Info"
87-
Logging.@debug "Debug"
88-
end
89-
@spawn timeout(timeout_sec, c)
90-
@test take!(c) == "Ok"
9174
end

0 commit comments

Comments
 (0)