We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$logger = TTY::Logger.new(output: :console) do |cfg| cfg.metadata = %i[date time file] cfg.types = { success: { level: :info }, task: { level: :info }, err: { level: :error } } cfg.handlers = [ [ :console, { styles: { success: { symbol: "\u2705", label: "[#{Paint['SUCCESS', 'green']}]", color: :green, levelpad: 2 }, err: { symbol: "\u2717", label: "[#{Paint['ERROR', 'red']}]", color: :red, levelpad: 2 }, task: { symbol: "\u2192", label: "[#{Paint['STARTING TASK', 'orange']}]:", color: :pale, levelpad: 2 } } } ] ] end
Traceback (most recent call last): 3: from /sites/make_dirs.rb:21:in `<main>' 2: from /sites/make_dirs.rb:21:in `new' 1: from /var/lib/gems/2.5.0/gems/tty-logger-0.1.0/lib/tty/logger.rb:44:in `initialize' /sites/make_dirs.rb:24:in `block in <main>': undefined method `types=' for #<TTY::Logger::Config:0x000055734c1272e8> (NoMethodError)
root@gems:/sites# gem query -r tty-logger *** REMOTE GEMS *** rails-pretty-logger (0.2.6) tty-logger (0.1.0)
The text was updated successfully, but these errors were encountered:
Hi, thanks for taking a look at this gem!
It's because I haven't released a new version yet changelog. I will try release shortly.
Sorry, something went wrong.
Hi Ken,
Sorry for the late reply but I took a bit of a break from open source. However, I'm back and just released v0.2.0.
v0.2.0
Few comments on your sample. The :output needs to be an IO object see output streams section. By default, it uses stderr.
:output
IO
stderr
You cannot use :success as the name as it's already defined by the library. I changed it to :succ.
:success
:succ
All the colours are based on the pastel gem.
With these changes a fully working code looks like this:
require "pastel" pastel = Pastel.new logger = TTY::Logger.new do |cfg| cfg.metadata = %i[date time file] cfg.types = { succ: { level: :info }, task: { level: :info }, err: { level: :error } } cfg.handlers = [ [ :console, { styles: { succ: { symbol: "\u2705", label: "[#{pastel.green('SUCCESS')}]", color: :green, levelpad: 2 }, err: { symbol: "\u2717", label: "[#{pastel.red('ERROR')}]", color: :red, levelpad: 2 }, task: { symbol: "\u2192", label: "[#{pastel.yellow('STARTING TASK')}]:", color: :yellow, levelpad: 2 } } } ] ] end logger.succ "Test" logger.task "Test" logger.err "Test"
I hope this helps!
No branches or pull requests
Applicable Code
Traceback
Gem Query
The text was updated successfully, but these errors were encountered: