Top Level Namespace

Defined Under Namespace

Modules: JSON, Rubocoin Classes: Blockchain, Hash

Instance Method Summary collapse

Instance Method Details

#debug(msg = '', descriptor = $stdout) ⇒ Object

Prints msg to the given descriptor in the form of “[DEBUG] - msg”



28
29
30
# File 'lib/rubocoin/text/print_utils.rb', line 28

def debug(msg = '', descriptor = $stdout)
  descriptor.puts("[#{'DEBUG'.yellow}] - #{msg}")
end

#debug_with_timestamp(msg = '', descriptor = $stdout) ⇒ Object

Prints an debug message with a timestamp prepended to it Example: 2005-03-19 15:10:26,618 - [DEBUG] - msg

See Also:



35
36
37
# File 'lib/rubocoin/text/print_utils.rb', line 35

def debug_with_timestamp(msg = '', descriptor = $stdout)
  descriptor.puts("#{Time.now} - [#{'DEBUG'.yellow}] - #{msg}")
end

#error(msg = '', descriptor = $stdout) ⇒ Object

Prints msg to the given descriptor in the form of “[ERROR] - msg”



16
17
18
# File 'lib/rubocoin/text/print_utils.rb', line 16

def error(msg = '', descriptor = $stdout)
  descriptor.puts("[#{'ERROR'.red}] - #{msg}")
end

#error_with_timestamp(msg = '', descriptor = $stdout) ⇒ Object

Prints an error message with a timestamp prepended to it Example: 2005-03-19 15:10:26,618 - [ERROR] - msg

See Also:



23
24
25
# File 'lib/rubocoin/text/print_utils.rb', line 23

def error_with_timestamp(msg = '', descriptor = $stdout)
  descriptor.puts("#{Time.now} - [#{'ERROR'.blue}] - #{msg}")
end

#info(msg = '', descriptor = $stdout) ⇒ Object

Prints msg to the given descriptor in the form of “[INFO] - msg”



4
5
6
# File 'lib/rubocoin/text/print_utils.rb', line 4

def info(msg = '', descriptor = $stdout)
  descriptor.puts("[#{'INFO'.blue}] - #{msg}")
end

#info_with_timestamp(msg = '', descriptor = $stdout) ⇒ Object

Prints an informational message with a timestamp prepended to it Example: 2005-03-19 15:10:26,618 - [INFO] - msg

See Also:



11
12
13
# File 'lib/rubocoin/text/print_utils.rb', line 11

def info_with_timestamp(msg = '', descriptor = $stdout)
  descriptor.puts("#{Time.now} - [#{'INFO'.blue}] - #{msg}")
end

#new_with_timestamp(msg = '', descriptor = $stdout) ⇒ Object

Prints a ‘NEW’ message with a timestamp prepended to it. Usually used for new blocks being formed Example: 2005-03-19 15:10:26,618 - [NEW] - msg

See Also:

  • #new


48
49
50
# File 'lib/rubocoin/text/print_utils.rb', line 48

def new_with_timestamp(msg = '', descriptor = $stdout)
  descriptor.puts("#{Time.now} - [#{'NEW'.green}] - #{msg}")
end

Prints msg to the given descriptor in the form of “[NEW] - msg”



40
41
42
# File 'lib/rubocoin/text/print_utils.rb', line 40

def print_new(msg = '', descriptor = $stdout)
  descriptor.puts("[#{'NEW'.green}] - #{msg}")
end