Using boolean value from editor in the editor itself

Im trying to make a script that has a generate button and a checkbox/boolean.
The generate button works fine but the boolean shows but cant be toggled.
What i want is that when the boolean is checked the Console will be cleared but if it isnt checked than it should not the code because the boolean should be false.

GeneratorInspector.cs

using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(Generator))]
public class GeneratorInspector : Editor {

bool console = true;

public override void OnInspectorGUI() {
	base.OnInspectorGUI();

	Generator mygen = (Generator)target;
	if(GUILayout.Button("Regenerate")) {

		// If clearconsole is ticked
		if(console == true) {
			// This simply does "LogEntries.Clear()" the long way:
			var logEntries = System.Type.GetType("UnityEditorInternal.LogEntries,UnityEditor.dll");
			var clearMethod = logEntries.GetMethod("Clear", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
			clearMethod.Invoke(null,null);
		}
		Generator gen = (Generator)target;
		gen.GenerateBlocks();
	}
	console = EditorGUILayout.Toggle("Clear console", true);
}

You’re calling EditorGUILayout.Toggle with a starting value of true, rather than the content of console, which means it will get reset to true the next time the GUI is drawn after you uncheck it (which will most likely be almost instant). You probably want something like:

console = EditorGUILayout.Toggle("Clear console", console);