Sha256: 0d7376f4e9d841827b2fb2b7a526987f3738343535bfc63e6b55d18050e963bd
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2020-2022, by Samuel Williams. require_relative 'client' require 'console/logger' module Async module Container module Notify # Implements a general process readiness protocol with output to the local console. class Console < Client # Open a notification client attached to the current console. def self.open!(logger = ::Console.logger) self.new(logger) end # Initialize the notification client. # @parameter logger [Console::Logger] The console logger instance to send messages to. def initialize(logger) @logger = logger end # Send a message to the console. def send(level: :debug, **message) @logger.send(level, self) {message} end # Send an error message to the console. # @parameters text [String] The details of the error condition. # @parameters message [Hash] Additional details to send with the message. def error!(text, **message) send(status: text, level: :error, **message) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
async-container-0.17.1 | lib/async/container/notify/console.rb |
async-container-0.17.0 | lib/async/container/notify/console.rb |
async-container-0.16.13 | lib/async/container/notify/console.rb |