-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move public interface to
Console::Interface
and extend it into `Con…
…sole`.
- Loading branch information
Showing
2 changed files
with
55 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# frozen_string_literal: true | ||
|
||
# Released under the MIT License. | ||
# Copyright 2024, by Samuel Williams. | ||
|
||
require_relative "logger" | ||
|
||
module Console | ||
# The public logger interface. | ||
module Interface | ||
# Get the current logger instance. | ||
def logger | ||
Logger.instance | ||
end | ||
|
||
# Set the current logger instance. | ||
# | ||
# The current logger instance is assigned per-fiber. | ||
def logger= instance | ||
Logger.instance= instance | ||
end | ||
|
||
# Emit a debug log message. | ||
def debug(...) | ||
Logger.instance.debug(...) | ||
end | ||
|
||
# Emit an informational log message. | ||
def info(...) | ||
Logger.instance.info(...) | ||
end | ||
|
||
# Emit a warning log message. | ||
def warn(...) | ||
Logger.instance.warn(...) | ||
end | ||
|
||
# Emit an error log message. | ||
def error(...) | ||
Logger.instance.error(...) | ||
end | ||
|
||
# Emit a fatal log message. | ||
def fatal(...) | ||
Logger.instance.fatal(...) | ||
end | ||
|
||
# Emit a log message with arbitrary arguments and options. | ||
def call(...) | ||
Logger.instance.call(...) | ||
end | ||
end | ||
end |