-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replaced println() with LogLevel macros (issue #10)
- Loading branch information
Showing
10 changed files
with
152 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env julia | ||
# -*- coding: UTF-8 -*- | ||
# __julia-version__ = 1.10.0 | ||
# __author__ = "Martin Scheidt" | ||
# __copyright__ = "2024" | ||
# __license__ = "ISC" | ||
|
||
using Logging | ||
|
||
function log_messages() | ||
# @logmsg TrainRuns.Trace "trace" # currently no macro for testing self defined loglevels | ||
@debug "debug" | ||
@info "info" | ||
@warn "warn" | ||
@error "error" | ||
# @logmsg TrainRuns.Fatal "fatal" # currently no macro for testing self defined loglevels | ||
end | ||
|
||
@testset "logging levels" begin | ||
logger = ConsoleLogger(TrainRuns.get_loglevel(Settings(verbosity = :trace))) | ||
# currently no macro for testing self defined loglevels | ||
# TODO: add @test_logs (:trace, "trace") (:fatal, "fatal") | ||
with_logger(logger) do | ||
@test_logs (:debug, "debug") (:info, "info") (:warn, "warn") (:error, "error") min_level=TrainRuns.Trace log_messages() | ||
end | ||
|
||
@test TrainRuns.get_loglevel(Settings(verbosity = :trace)) == LogLevel(-2000) | ||
@test TrainRuns.get_loglevel(Settings(verbosity = :debug)) == LogLevel(-1000) | ||
@test TrainRuns.get_loglevel(Settings(verbosity = :info)) == LogLevel(0) | ||
@test TrainRuns.get_loglevel(Settings()) == LogLevel(0) | ||
@test TrainRuns.get_loglevel(Settings(verbosity = :warn)) == LogLevel(1000) | ||
@test TrainRuns.get_loglevel(Settings(verbosity = :error)) == LogLevel(2000) | ||
@test TrainRuns.get_loglevel(Settings(verbosity = :fatal)) == LogLevel(3000) | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,5 @@ | |
|
||
using TrainRuns, Test | ||
|
||
include("logging_test.jl") | ||
include("logging_levels.jl") | ||
include("highlevel_test.jl") |