Skip to content

Instantly share code, notes, and snippets.

@DeeJayhX
Created May 17, 2017 07:54
Show Gist options
  • Save DeeJayhX/d936a0e7255832cd1191b7e203be86a0 to your computer and use it in GitHub Desktop.
Save DeeJayhX/d936a0e7255832cd1191b7e203be86a0 to your computer and use it in GitHub Desktop.
def addLog( msg, type=0, game=0, write_to_file=$file_log )
#Type: 0=Info, 1=Warning, 2=Error, 3=Debug, 4=Start, 5=Stop
#Game: 0=None, 1=Roulette, 2=Crash
Console.write Time.now.strftime("%H:%M:%S"), :white
case type
when 0
Console.write "|Info: ", :white
when 1
Console.write "|Warning: ", :yellow
when 2
Console.write "|Error: ", :black, :red
when 3
Console.write "|Debug: ", :magenta
when 4
Console.write "|Start: ", :green
when 5
Console.write "|Stop: ", :red
else
Console.write "|NO TYPE?: ", :darkgray
end
case game
when 1
Console.puts "Roulette: " + msg, :red
when 2
Console.puts "Crash: " + msg, :blue
else
Console.puts msg, :white
end
if write_to_file
if $log_file
$log_file.syswrite( msg )
else
puts "Critical Error: Console log file not opened. This should never happen."
end
end
end
addLog( "Started Roulette", 4, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment