Debugging_console
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © plutustraining

//@version=5

library(title = "Debugging_console", overlay = false)

var string[] console = array.new_string(25, na)

export print(string[] console , string input) => 

	
	array.push(console, str.tostring(year(time))+'-' +str.tostring(month(time))+'-' +str.tostring(dayofmonth(time))+' '+input)
	array.shift(console)
	
	var table console_table = table.new(position.bottom_left, 1, 1,frame_color = color.white,frame_width =1)
	string console_content = na

	for i = 0 to array.size(console)-1
		array_content = na(array.get(console, i))? '' :array.get(console, i)
		console_content +=  array_content + '\n'
		table.cell(console_table, 0, 0, console_content, bgcolor = color.black,text_halign=text.align_left,text_color=color.white)
	console
		

//library testing

if barstate.islast
	console :=print(console, "Debug testing")
	


