Class: Mysqlknife::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/mysqlknife/log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLog

Returns a new instance of Log.



7
8
9
# File 'lib/mysqlknife/log.rb', line 7

def initialize
  @log = Logger.new(STDOUT)
end

Instance Attribute Details

#verbose=(value) ⇒ Object (writeonly)

Sets the attribute verbose

Parameters:

  • value

    the value to set the attribute verbose to.



5
6
7
# File 'lib/mysqlknife/log.rb', line 5

def verbose=(value)
  @verbose = value
end

Instance Method Details

#command(command) ⇒ Object



25
26
27
# File 'lib/mysqlknife/log.rb', line 25

def command(command)
  @log.debug("Bash Command: #{command}") if $DEBUG
end

#kill(process) ⇒ Object



11
12
13
14
# File 'lib/mysqlknife/log.rb', line 11

def kill(process)
  process = process.map { |k, v| "#{k}: #{v}" }.join(', ')
  @log.info("Kill MySQL Process: #{process}")
end

#skip_repl_error(status) ⇒ Object



29
30
31
32
# File 'lib/mysqlknife/log.rb', line 29

def skip_repl_error(status)
  status = status.map { |k, v| "#{k}: #{v}" }.join(', ')
  @log.info("MySQL Skip error replica: #{status}")
end

#sql(statement) ⇒ Object



16
17
18
# File 'lib/mysqlknife/log.rb', line 16

def sql(statement)
  @log.debug("SQL Statement: #{statement}") if $DEBUG
end

#sql_error(error, sql) ⇒ Object



20
21
22
23
# File 'lib/mysqlknife/log.rb', line 20

def sql_error(error, sql)
  @log.debug("SQL Error: #{error}")
  @log.debug("SQL Statement: #{sql}")
end