Line drawn callback

Below i have made an example of interactive line drawing which works great.
However i need to react on (create a callback for) line_created and also line_edited somehow.

How do i do that?

import bokeh
from bokeh.models import (RangeSlider, CustomJS, ColumnDataSource, LinearAxis,
                          Button, FileInput, Spinner, PolyDrawTool, HoverTool,
                          Range1d, LabelSet, Div, Paragraph, Spacer, TextInput,
                          BoxEditTool,MultiLine)
from bokeh import events
from bokeh.layouts import column, row
from bokeh.plotting import figure, show, gridplot, curdoc
from bokeh.io import output_notebook, reset_output
from IPython.core.display import display, HTML
from bokeh.resources import INLINE
from bokeh.palettes import Category20
from bokeh.util.compiler import TypeScript

print('Bokeh version : ', bokeh.__version__)
reset_output()
output_notebook(resources = INLINE, verbose=False, hide_banner=False)

class LineDrawTool(PolyDrawTool):
    __implementation__ = TypeScript('''
    import { PolyDrawTool } from "models/tools/edit/poly_draw_tool";
    export class LineDrawTool extends PolyDrawTool {
      tool_name = "Line draw tool";
    }
    ''')
    
def add_line_to_plot(p, line_source, line_color, line_shadow_color):
    """Add linebuilder line to plot"""
    renderer_black = p.multi_line('xs', 'ys', line_width=4, alpha=0.7, line_color=line_shadow_color, source=line_source, line_cap='round')
    renderer_colored = p.multi_line('xs', 'ys', line_width=2, alpha=0.9, line_color=line_color, source=line_source, line_cap='round')
    renderer_black.selection_glyph = MultiLine(line_color=line_shadow_color, line_width=6, line_cap='round')
    renderer_colored.selection_glyph = MultiLine(line_color="#FFFFFF", line_width=3, line_cap='round')
    return renderer_black, renderer_colored
    
def add_line_tool_to_plots(plots, tool,
                           line_source, line_color, line_shadow_color):
    line_renderers = []
    for plot in plots:
        r_shadow, r_color = add_line_to_plot(plot, line_source,
                                             line_color, line_shadow_color)
        line_renderers.append(r_shadow)
        line_renderers.append(r_color)
    line_tool = tool(renderers=line_renderers)
    for plot in plots:
        plot.add_tools(line_tool)

    return line_renderers

line_source = ColumnDataSource({'xs': [], 'ys': [],
                                'startx': [], 'starty': [],
                                'endx': [], 'endy': [],
                                'slope': []})


p = figure()

p.circle([1,2],[5,6])


line_renderers = add_line_tool_to_plots([p], LineDrawTool,
                                             line_source,
                                             'white', 'black')

export_func = CustomJS(args=dict(line_source=line_source),
                                  code='''
                                  for (var i = 0; i < line_source.data.xs.length; i++) {
                                      console.log("line added");
                                      console.log(line_source.data.xs[i][0]);
                                  }
                                  
                                  ''')

export_button = Button(label="Export slope file")
export_button.js_on_event(events.ButtonClick, export_func)

show(column(row(p,export_button)))