Fix logging bug and element ID bug

Fixes two small bugs:
 * Logging callback is now called for every logged event.
 * The code assumed the elements of the code containers had certain IDs, even though the IDs can be given as options to the widget. The options are now used.