change the output format
This commit is contained in:
1 parent
c2000484bb
commit
b123e6b3c5
1 file changed
+15
-1
+15
-1
@@ -100,11 +100,25 @@ private ######################################################################
|
|||||||
|
|
||||||
def info(message, process=nil)
|
def info(message, process=nil)
|
||||||
print process.color if process
|
print process.color if process
|
||||||
print "[#{Time.now.strftime("%H:%M:%S")}] [#{process ? process.name : "system"}] #{message.chomp}"
|
print "#{Time.now.strftime("%H:%M:%S")} #{pad_process_name(process)} | "
|
||||||
print Term::ANSIColor.reset
|
print Term::ANSIColor.reset
|
||||||
|
print message.chomp
|
||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def longest_process_name
|
||||||
|
@longest_process_name ||= begin
|
||||||
|
longest = processes.keys.map { |name| name.length }.sort.last
|
||||||
|
longest = 6 if longest < 6 # system
|
||||||
|
longest
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def pad_process_name(process)
|
||||||
|
name = process ? process.name : "system"
|
||||||
|
name.ljust(longest_process_name)
|
||||||
|
end
|
||||||
|
|
||||||
def print_info
|
def print_info
|
||||||
info "currently running processes:"
|
info "currently running processes:"
|
||||||
running_processes.each do |pid, process|
|
running_processes.each do |pid, process|
|
||||||
|
|||||||
Reference in new issue
Block a user