Forráskód Böngészése

Changed all Logging to loglevel

Benjamin Giesinger 7 éve
szülő
commit
36bce17d6d

+ 0 - 21
src/Common/Logging.ts

@@ -1,21 +0,0 @@
-/* tslint:disable:no-console */
-
-/**
- * Class for logging messages, mainly for debugging purposes.
- * It should be refactored soon, when an external logging framework
- * will be chosen (probably log4js).
- */
-export class Logging {
-    public static debug(...args: any[]): void {
-        console.debug("[opensheetmusicdisplay] ", args.join(" "));
-    }
-    public static log(...args: any[]): void {
-        console.log("[opensheetmusicdisplay] ", args.join(" "));
-    }
-    public static error(...args: any[]): void {
-        console.error("[opensheetmusicdisplay] ", args.join(" "));
-    }
-    public static warn(...args: any[]): void {
-        console.warn("[opensheetmusicdisplay] ", args.join(" "));
-    }
-}

+ 2 - 2
src/MusicalScore/Graphical/EngravingRules.ts

@@ -1,6 +1,6 @@
 import {PagePlacementEnum} from "./GraphicalMusicPage";
 //import {MusicSymbol} from "./MusicSymbol";
-import {Logging} from "../../Common/Logging";
+import * as log from "loglevel";
 
 export class EngravingRules {
     private static rules: EngravingRules;
@@ -315,7 +315,7 @@ export class EngravingRules {
             //        + 7 * FontInfo.Info.getBoundingBox(MusicSymbol.SHARP).width;
             //}
         } catch (ex) {
-            Logging.log("EngravingRules()", ex);
+            log.info("EngravingRules()", ex);
         }
 
     }

+ 4 - 4
src/MusicalScore/Graphical/GraphicalMusicSheet.ts

@@ -17,7 +17,7 @@ import {GraphicalNote} from "./GraphicalNote";
 import {Instrument} from "../Instrument";
 import {BoundingBox} from "./BoundingBox";
 import {MusicSheetCalculator} from "./MusicSheetCalculator";
-import {Logging} from "../../Common/Logging";
+import * as log from "loglevel";
 import Dictionary from "typescript-collections/dist/lib/Dictionary";
 import {CollectionUtil} from "../../Util/CollectionUtil";
 import {SelectionStartSymbol} from "./SelectionStartSymbol";
@@ -634,7 +634,7 @@ export class GraphicalMusicSheet {
         try {
             return this.GetClickableLabel(positionOnMusicSheet);
         } catch (ex) {
-            Logging.log("GraphicalMusicSheet.tryGetClickableObject", "positionOnMusicSheet: " + positionOnMusicSheet, ex);
+            log.info("GraphicalMusicSheet.tryGetClickableObject", "positionOnMusicSheet: " + positionOnMusicSheet, ex);
         }
 
         return undefined;
@@ -648,7 +648,7 @@ export class GraphicalMusicSheet {
             }
             return entry.getAbsoluteTimestamp();
         } catch (ex) {
-            Logging.log(
+            log.info(
                 "GraphicalMusicSheet.tryGetTimeStampFromPosition",
                 "positionOnMusicSheet: " + positionOnMusicSheet, ex
             );
@@ -680,7 +680,7 @@ export class GraphicalMusicSheet {
                 }
             }
         } catch (ex) {
-            Logging.log("GraphicalMusicSheet.getStaffEntry", ex);
+            log.info("GraphicalMusicSheet.getStaffEntry", ex);
         }
 
         return staffEntry;

+ 6 - 6
src/MusicalScore/Graphical/MusicSheetCalculator.ts

@@ -47,7 +47,7 @@ import {AccidentalCalculator} from "./AccidentalCalculator";
 import {MidiInstrument} from "../VoiceData/Instructions/ClefInstruction";
 import {Staff} from "../VoiceData/Staff";
 import {OctaveShift} from "../VoiceData/Expressions/ContinuousExpressions/OctaveShift";
-import {Logging} from "../../Common/Logging";
+import * as log from "loglevel";
 import Dictionary from "typescript-collections/dist/lib/Dictionary";
 import {GraphicalLyricEntry} from "./GraphicalLyricEntry";
 import {GraphicalLyricWord} from "./GraphicalLyricWord";
@@ -592,7 +592,7 @@ export abstract class MusicSheetCalculator {
      */
     protected handleStaffEntryLink(graphicalStaffEntry: GraphicalStaffEntry,
                                    staffEntryLinks: StaffEntryLink[]): void {
-        Logging.debug("handleStaffEntryLink not implemented");
+        log.debug("handleStaffEntryLink not implemented");
     }
 
     /**
@@ -760,22 +760,22 @@ export abstract class MusicSheetCalculator {
     }
 
     protected updateSkyBottomLine(staffLine: StaffLine): void {
-        //Logging.debug("updateSkyBottomLine not implemented");
+        //log.debug("updateSkyBottomLine not implemented");
         return;
     }
 
     protected calculateSkyBottomLine(staffLine: StaffLine): void {
-        //Logging.debug("calculateSkyBottomLine not implemented");
+        //log.debug("calculateSkyBottomLine not implemented");
         return;
     }
 
     protected calculateMarkedAreas(): void {
-        //Logging.debug("calculateMarkedAreas not implemented");
+        //log.debug("calculateMarkedAreas not implemented");
         return;
     }
 
     protected calculateComments(): void {
-        //Logging.debug("calculateComments not implemented");
+        //log.debug("calculateComments not implemented");
         return;
     }
 

+ 5 - 5
src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts

@@ -15,7 +15,7 @@ import {SystemLinesEnum} from "../SystemLinesEnum";
 import {FontStyles} from "../../../Common/Enums/FontStyles";
 import {Fonts} from "../../../Common/Enums/Fonts";
 import {OutlineAndFillStyleEnum, OUTLINE_AND_FILL_STYLE_DICT} from "../DrawingEnums";
-import {Logging} from "../../../Common/Logging";
+import * as log from "loglevel";
 import { ArticulationEnum, StemDirectionType } from "../../VoiceData/VoiceEntry";
 import { SystemLinePosition } from "../SystemLinePosition";
 import { GraphicalVoiceEntry } from "../GraphicalVoiceEntry";
@@ -312,7 +312,7 @@ export class VexFlowConverter {
 
         // Make sure size is either "default" or "small"
         if (size !== "default" && size !== "small") {
-            Logging.warn(`Invalid VexFlow clef size "${size}" specified. Using "default".`);
+            log.warn(`Invalid VexFlow clef size "${size}" specified. Using "default".`);
             size = "default";
         }
 
@@ -333,7 +333,7 @@ export class VexFlowConverter {
                         break;
                     default:
                         type = "treble";
-                        Logging.error(`Clef ${ClefEnum[clef.ClefType]} on line ${clef.Line} not supported by VexFlow. Using default value "${type}".`);
+                        log.error(`Clef ${ClefEnum[clef.ClefType]} on line ${clef.Line} not supported by VexFlow. Using default value "${type}".`);
                 }
                 break;
 
@@ -351,7 +351,7 @@ export class VexFlowConverter {
                       break;
                   default:
                       type = "bass";
-                      Logging.error(`Clef ${ClefEnum[clef.ClefType]} on line ${clef.Line} not supported by VexFlow. Using default value "${type}".`);
+                      log.error(`Clef ${ClefEnum[clef.ClefType]} on line ${clef.Line} not supported by VexFlow. Using default value "${type}".`);
                 }
                 break;
 
@@ -372,7 +372,7 @@ export class VexFlowConverter {
                       break;
                   default:
                       type = "alto";
-                      Logging.error(`Clef ${ClefEnum[clef.ClefType]} on line ${clef.Line} not supported by VexFlow. Using default value "${type}".`);
+                      log.error(`Clef ${ClefEnum[clef.ClefType]} on line ${clef.Line} not supported by VexFlow. Using default value "${type}".`);
                 }
                 break;
 

+ 7 - 87
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -14,7 +14,7 @@ import {GraphicalNote} from "../GraphicalNote";
 import {GraphicalStaffEntry} from "../GraphicalStaffEntry";
 import StaveConnector = Vex.Flow.StaveConnector;
 import StaveNote = Vex.Flow.StaveNote;
-import {Logging} from "../../../Common/Logging";
+import * as log from "loglevel";
 import {unitInPixels} from "./VexFlowMusicSheetDrawer";
 import {Tuplet} from "../../VoiceData/Tuplet";
 import {RepetitionInstructionEnum} from "../../VoiceData/Instructions/RepetitionInstruction";
@@ -373,6 +373,7 @@ export class VexFlowMeasure extends StaffMeasure {
      * that Tied notes are not present in the normal voiceEntries.
      * To handle this, calculation with absolute timestamps is needed.
      * And the graphical notes have to be analysed directly (and not the voiceEntries, as it actually should be -> needs refactoring)
+     * @param voice the voice for which the ghost notes shall be searched.
      */
     private getRestFilledVexFlowStaveNotesPerVoice(voice: Voice): GraphicalVoiceEntry[] {
         let latestVoiceTimestamp: Fraction = undefined;
@@ -383,7 +384,6 @@ export class VexFlowMeasure extends StaffMeasure {
             // find the voiceEntry end timestamp:
             let gNotesEndTimestamp: Fraction = new Fraction();
             for (const graphicalNote of gve.notes) {
-                // console.log(graphicalNote);
                 const noteEnd: Fraction  = Fraction.plus(graphicalNote.sourceNote.getAbsoluteTimestamp(), graphicalNote.sourceNote.Length);
                 if (gNotesEndTimestamp < noteEnd) {
                     gNotesEndTimestamp = noteEnd;
@@ -396,13 +396,7 @@ export class VexFlowMeasure extends StaffMeasure {
                 // if this voice is new, check for a gap from measure start to the start of the current voice entry:
                 const gapFromMeasureStart: Fraction = Fraction.minus(gNotesStartTimestamp, this.parentSourceMeasure.AbsoluteTimestamp);
                 if (gapFromMeasureStart.RealValue > 0) {
-                    console.log("Ghost Found at start", this);
-                    /* tslint:disable-next-line:no-unused-variable */
-                    // FIXME: Add to graphicalVoiceEntry
-                    // ToDo: fill the gap with a rest ghost note
-                    // from this.parentSourceMeasure.AbsoluteTimestamp
-                    // with length gapFromMeasureStart:
-                    // (maybe remember in a list and add later in a second loop)
+                    log.debug("Ghost Found at start");
                     const vfghost: Vex.Flow.GhostNote = VexFlowConverter.GhostNote(gapFromMeasureStart);
                     const ghostGve: VexFlowVoiceEntry = new VexFlowVoiceEntry(undefined, undefined);
                     ghostGve.vfStaveNote = vfghost;
@@ -414,11 +408,7 @@ export class VexFlowMeasure extends StaffMeasure {
                 const inBetweenLength: Fraction = Fraction.minus(gNotesStartTimestamp, latestVoiceTimestamp);
 
                 if (inBetweenLength.RealValue > 0) {
-                    console.log("Ghost Found in between", this);
-                    // ToDo: fill the gap with a rest ghost note
-                    // starting from latestVoiceTimestamp
-                    // with length restLength:
-                    // (maybe remember in a list and add later in a second loop)
+                    log.debug("Ghost Found in between");
                     const vfghost: Vex.Flow.GhostNote = VexFlowConverter.GhostNote(inBetweenLength);
                     const ghostGve: VexFlowVoiceEntry = new VexFlowVoiceEntry(undefined, undefined);
                     ghostGve.vfStaveNote = vfghost;
@@ -439,83 +429,13 @@ export class VexFlowMeasure extends StaffMeasure {
             // fill the gap with a rest ghost note
             // starting from lastFraction
             // with length restLength:
-            console.log("Ghost Found at end",  this);
+            log.debug("Ghost Found at end");
             const vfghost: Vex.Flow.GhostNote = VexFlowConverter.GhostNote(restLength);
             const ghostGve: VexFlowVoiceEntry = new VexFlowVoiceEntry(undefined, undefined);
             ghostGve.vfStaveNote = vfghost;
             gvEntries.push(ghostGve);
         }
         return gvEntries;
-
-        // // 1) find front- and in-measure-gaps:
-        // for (const staffEntry of this.staffEntries as VexFlowStaffEntry[]) {
-        //     for (const gNotesPerVoice of staffEntry.graphicalVoiceEntries.map(gve => gve.notes)) {
-        //         // get voice id:
-        //         const voiceId: number = gNotesPerVoice[0].sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;
-        //         const gNotesStartTimestamp: Fraction = gNotesPerVoice[0].sourceNote.getAbsoluteTimestamp();
-
-        //         // find the voiceEntry end timestamp:
-        //         let gNotesEndTimestamp: Fraction = new Fraction();
-        //         for (const graphicalNote of gNotesPerVoice) {
-        //             // console.log(graphicalNote);
-        //             const noteEnd: Fraction  = Fraction.plus(graphicalNote.sourceNote.getAbsoluteTimestamp(), graphicalNote.sourceNote.Length);
-        //             if (gNotesEndTimestamp < noteEnd) {
-        //                 gNotesEndTimestamp = noteEnd;
-        //             }
-        //         }
-
-        //         // ToDo: maybe check needed if this throws an exception when not in dict:
-        //         const latestVoiceTimestamp: Fraction = latestVoiceTimestampDict[voiceId];
-
-        //         // check if this voice has just been found the first time:
-        //         if (latestVoiceTimestamp === undefined) {
-
-        //             // if this voice is new, check for a gap from measure start to the start of the current voice entry:
-        //             const gapFromMeasureStart: Fraction = Fraction.minus(gNotesStartTimestamp, this.parentSourceMeasure.AbsoluteTimestamp);
-        //             if (gapFromMeasureStart.RealValue > 0) {
-        //                 console.log("Ghost Found at start");
-        //                 /* tslint:disable-next-line:no-unused-variable */
-        //                 const vfghost: Vex.Flow.GhostNote = VexFlowConverter.GhostNote(gapFromMeasureStart);
-        //                 // FIXME: Add to graphicalVoiceEntry
-        //                 // ToDo: fill the gap with a rest ghost note
-        //                 // from this.parentSourceMeasure.AbsoluteTimestamp
-        //                 // with length gapFromMeasureStart:
-        //                 // (maybe remember in a list and add later in a second loop)
-
-        //             }
-        //         } else {
-        //             // get the length of the empty space between notes:
-        //             const restLength: Fraction = Fraction.minus(gNotesStartTimestamp, latestVoiceTimestamp);
-
-        //             if (restLength.RealValue > 0) {
-        //                 console.log("Ghost Found in between");
-        //                 // ToDo: fill the gap with a rest ghost note
-        //                 // starting from latestVoiceTimestamp
-        //                 // with length restLength:
-        //                 // (maybe remember in a list and add later in a second loop)
-
-        //             }
-        //         }
-
-        //         // finally set the latest timestamp of this voice to the end timestamp of the longest note in the current voiceEntry:
-        //         latestVoiceTimestampDict[voiceId] = gNotesEndTimestamp;
-        //     }
-        // }
-
-        // // 2) find gaps from last notes to end of this measure:
-        // for (const voiceId in latestVoiceTimestampDict) {
-        //     if (voiceId !== undefined) {
-        //         const lastFraction: Fraction = latestVoiceTimestampDict[voiceId];
-        //         const measureEndTimestamp: Fraction = Fraction.plus(this.parentSourceMeasure.AbsoluteTimestamp, this.parentSourceMeasure.Duration);
-        //         const restLength: Fraction  = Fraction.minus(measureEndTimestamp, lastFraction);
-        //         if (restLength.RealValue > 0) {
-        //             // fill the gap with a rest ghost note
-        //             // starting from lastFraction
-        //             // with length restLength:
-        //             console.log("Ghost Found at end",  this);
-        //         }
-        //     }
-        // }
     }
 
     /**
@@ -608,7 +528,7 @@ export class VexFlowMeasure extends StaffMeasure {
                         //     (<Vex.Flow.StaveNote> note).setStyle({fillStyle: "green", strokeStyle: "green"});
                         // }
                     } else {
-                        Logging.log("Warning! Beam with no notes!");
+                        log.debug("Warning! Beam with no notes!");
                     }
                 }
             }
@@ -643,7 +563,7 @@ export class VexFlowMeasure extends StaffMeasure {
                                                             num_notes: tupletStaveNotes.length //, location: -1, ratioed: true
                                                           }));
                     } else {
-                        Logging.log("Warning! Tuplet with no notes! Trying to ignore, but this is a serious problem.");
+                        log.debug("Warning! Tuplet with no notes! Trying to ignore, but this is a serious problem.");
                     }
                 }
             }

+ 2 - 2
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -24,7 +24,7 @@ import {VexFlowMeasure} from "./VexFlowMeasure";
 import {VexFlowTextMeasurer} from "./VexFlowTextMeasurer";
 
 import Vex = require("vexflow");
-import {Logging} from "../../../Common/Logging";
+import * as log from "loglevel";
 import {unitInPixels} from "./VexFlowMusicSheetDrawer";
 import {VexFlowGraphicalNote} from "./VexFlowGraphicalNote";
 import {TechnicalInstruction} from "../../VoiceData/Instructions/TechnicalInstruction";
@@ -99,7 +99,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
             }
         }
         if (voices.length === 0) {
-            Logging.warn("Found a measure with no voices... Continuing anyway.", mvoices);
+            log.warn("Found a measure with no voices... Continuing anyway.", mvoices);
             continue;
         }
         formatter.joinVoices(voices);

+ 2 - 2
src/MusicalScore/MusicParts/MusicPartManagerIterator.ts

@@ -14,7 +14,7 @@ import {ContinuousDynamicExpression} from "../VoiceData/Expressions/ContinuousEx
 import {InstantaniousDynamicExpression} from "../VoiceData/Expressions/InstantaniousDynamicExpression";
 import {MultiTempoExpression} from "../VoiceData/Expressions/MultiTempoExpression";
 import {AbstractExpression} from "../VoiceData/Expressions/AbstractExpression";
-import {Logging} from "../../Common/Logging";
+import * as log from "loglevel";
 
 export class MusicPartManagerIterator {
     constructor(manager: MusicPartManager, startTimestamp?: Fraction, endTimestamp?: Fraction) {
@@ -47,7 +47,7 @@ export class MusicPartManagerIterator {
             }
             this.currentTempoChangingExpression = this.activeTempoExpression;
         } catch (err) {
-            Logging.log("MusicPartManagerIterator: " + err);
+            log.info("MusicPartManagerIterator: " + err);
         }
 
     }

+ 4 - 4
src/MusicalScore/MusicSheet.ts

@@ -16,7 +16,7 @@ import {EngravingRules} from "./Graphical/EngravingRules";
 import {NoteState} from "./Graphical/DrawingEnums";
 import {Note} from "./VoiceData/Note";
 import {VoiceEntry} from "./VoiceData/VoiceEntry";
-import {Logging} from "../Common/Logging";
+import * as log from "loglevel";
 
 // FIXME Andrea: Commented out some unnecessary/not-ported-yet code, have a look at (*)
 
@@ -400,7 +400,7 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
     //        }
     //        return repetitions;
     //    } catch (ex) {
-    //        Logging.log("MusicSheet.IRepetitions get: ", ex);
+    //        log.info("MusicSheet.IRepetitions get: ", ex);
     //        return undefined;
     //    }
     //
@@ -423,7 +423,7 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
         try {
             return this.getFirstSourceMeasure().MeasureNumber;
         } catch (ex) {
-            Logging.log("MusicSheet.FirstMeasureNumber: ", ex);
+            log.info("MusicSheet.FirstMeasureNumber: ", ex);
             return 0;
         }
 
@@ -432,7 +432,7 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
         try {
             return this.getLastSourceMeasure().MeasureNumber;
         } catch (ex) {
-            Logging.log("MusicSheet.LastMeasureNumber: ", ex);
+            log.info("MusicSheet.LastMeasureNumber: ", ex);
             return 0;
         }
 

+ 2 - 2
src/MusicalScore/MusicSource/Repetition.ts

@@ -4,7 +4,7 @@ import {Fraction} from "../../Common/DataObjects/Fraction";
 import {MusicSheet} from "../MusicSheet";
 import {RepetitionInstruction} from "../VoiceData/Instructions/RepetitionInstruction";
 import {PartListEntry} from "./PartListEntry";
-import {Logging} from "../../Common/Logging";
+import * as log from "loglevel";
 
 export class Repetition extends PartListEntry /*implements IRepetition*/ {
     constructor(musicSheet: MusicSheet, virtualOverallRepetition: boolean) {
@@ -84,7 +84,7 @@ export class Repetition extends PartListEntry /*implements IRepetition*/ {
                     this.numberOfEndings = endingNumber;
                 }
             } catch (err) {
-                Logging.error("Repetition: Exception.", err);
+                log.error("Repetition: Exception.", err);
             }
 
         }

+ 14 - 14
src/MusicalScore/ScoreIO/InstrumentReader.ts

@@ -17,7 +17,7 @@ import {RhythmSymbolEnum} from "../VoiceData/Instructions/RhythmInstruction";
 import {KeyEnum} from "../VoiceData/Instructions/KeyInstruction";
 import {IXmlAttribute} from "../../Common/FileIO/Xml";
 import {ChordSymbolContainer} from "../VoiceData/ChordSymbolContainer";
-import {Logging} from "../../Common/Logging";
+import * as log from "loglevel";
 import {MidiInstrument} from "../VoiceData/Instructions/ClefInstruction";
 import {ChordSymbolReader} from "./MusicSymbolModules/ChordSymbolReader";
 import { RepetitionInstructionReader } from "./MusicSymbolModules/RepetitionInstructionReader";
@@ -139,7 +139,7 @@ export class InstrumentReader {
             if (xmlNode.element("staff") !== undefined) {
               noteStaff = parseInt(xmlNode.element("staff").value, 10);
               if (isNaN(noteStaff)) {
-                Logging.debug("InstrumentReader.readNextXmlMeasure.get staff number");
+                log.debug("InstrumentReader.readNextXmlMeasure.get staff number");
                 noteStaff = 1;
               }
             }
@@ -172,13 +172,13 @@ export class InstrumentReader {
             } else {
               const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError", "Invalid Note Duration.");
               this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
-              Logging.debug("InstrumentReader.readNextXmlMeasure", errorMsg);
+              log.debug("InstrumentReader.readNextXmlMeasure", errorMsg);
               continue;
             }
           }
 
           const restNote: boolean = xmlNode.element("rest") !== undefined;
-          //Logging.log("New note found!", noteDivisions, noteDuration.toString(), restNote);
+          //log.info("New note found!", noteDivisions, noteDuration.toString(), restNote);
           const isGraceNote: boolean = xmlNode.element("grace") !== undefined || noteDivisions === 0 || isChord && lastNoteWasGrace;
           let musicTimestamp: Fraction = currentFraction.clone();
           if (isChord) {
@@ -189,7 +189,7 @@ export class InstrumentReader {
             this.inSourceMeasureInstrumentIndex + noteStaff - 1,
             this.currentStaff
           ).staffEntry;
-          //Logging.log("currentStaffEntry", this.currentStaffEntry, this.currentMeasure.VerticalSourceStaffEntryContainers.length);
+          //log.info("currentStaffEntry", this.currentStaffEntry, this.currentMeasure.VerticalSourceStaffEntryContainers.length);
 
           if (!this.currentVoiceGenerator.hasVoiceEntry() || (!isChord && !isGraceNote && !lastNoteWasGrace) || (!lastNoteWasGrace && isGraceNote)) {
             this.currentVoiceGenerator.createVoiceEntry(musicTimestamp, this.currentStaffEntry, !restNote);
@@ -255,7 +255,7 @@ export class InstrumentReader {
             if (isNaN(this.divisions)) {
               const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/DivisionError",
                                                                       "Invalid divisions value at Instrument: ");
-              Logging.debug("InstrumentReader.readNextXmlMeasure", errorMsg);
+              log.debug("InstrumentReader.readNextXmlMeasure", errorMsg);
               this.divisions = this.readDivisionsFromNotes();
               if (this.divisions > 0) {
                 this.musicSheet.SheetErrors.push(errorMsg + this.instrument.Name);
@@ -380,7 +380,7 @@ export class InstrumentReader {
       }
       const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/MeasureError", "Error while reading Measure.");
       this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
-      Logging.debug("InstrumentReader.readNextXmlMeasure", errorMsg, e);
+      log.debug("InstrumentReader.readNextXmlMeasure", errorMsg, e);
     }
 
     this.previousMeasure = this.currentMeasure;
@@ -589,7 +589,7 @@ export class InstrumentReader {
             );
             this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
             line = 2;
-            Logging.debug("InstrumentReader.addAbstractInstruction", errorMsg, ex);
+            log.debug("InstrumentReader.addAbstractInstruction", errorMsg, ex);
           }
 
         }
@@ -617,7 +617,7 @@ export class InstrumentReader {
             this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
             clefEnum = ClefEnum.G;
             line = 2;
-            Logging.debug("InstrumentReader.addAbstractInstruction", errorMsg, e);
+            log.debug("InstrumentReader.addAbstractInstruction", errorMsg, e);
           }
 
         }
@@ -665,7 +665,7 @@ export class InstrumentReader {
           );
           this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
           key = 0;
-          Logging.debug("InstrumentReader.addAbstractInstruction", errorMsg, ex);
+          log.debug("InstrumentReader.addAbstractInstruction", errorMsg, ex);
         }
 
       }
@@ -684,7 +684,7 @@ export class InstrumentReader {
           );
           this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
           keyEnum = KeyEnum.major;
-          Logging.debug("InstrumentReader.addAbstractInstruction", errorMsg, ex);
+          log.debug("InstrumentReader.addAbstractInstruction", errorMsg, ex);
         }
 
       }
@@ -754,7 +754,7 @@ export class InstrumentReader {
           this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
           num = 4;
           denom = 4;
-          Logging.debug("InstrumentReader.addAbstractInstruction", errorMsg, ex);
+          log.debug("InstrumentReader.addAbstractInstruction", errorMsg, ex);
         }
 
         if ((num === 4 && denom === 4) || (num === 2 && denom === 2)) {
@@ -978,7 +978,7 @@ export class InstrumentReader {
   //        );
   //        this.musicSheet.SheetErrors.pushTemp(errorMsg);
   //        directionStaffNumber = 1;
-  //        logging.debug("InstrumentReader.readExpressionStaffNumber", errorMsg, ex);
+  //        log.debug("InstrumentReader.readExpressionStaffNumber", errorMsg, ex);
   //      }
   //
   //    }
@@ -1012,7 +1012,7 @@ export class InstrumentReader {
               try {
                 noteDuration = parseInt(durationNode.value, 10);
               } catch (ex) {
-                Logging.debug("InstrumentReader.readDivisionsFromNotes", ex);
+                log.debug("InstrumentReader.readDivisionsFromNotes", ex);
                 continue;
               }
 

+ 7 - 7
src/MusicalScore/ScoreIO/MusicSheetReader.ts

@@ -6,7 +6,7 @@ import {IXmlElement} from "../../Common/FileIO/Xml";
 import {Instrument} from "../Instrument";
 import {ITextTranslation} from "../Interfaces/ITextTranslation";
 import {MusicSheetReadingException} from "../Exceptions";
-import {Logging} from "../../Common/Logging";
+import * as log from "loglevel";
 import {IXmlAttribute} from "../../Common/FileIO/Xml";
 import {RhythmInstruction} from "../VoiceData/Instructions/RhythmInstruction";
 import {RhythmSymbolEnum} from "../VoiceData/Instructions/RhythmInstruction";
@@ -63,7 +63,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
         try {
             return this._createMusicSheet(root, path);
         } catch (e) {
-            Logging.log("MusicSheetReader.CreateMusicSheet", e);
+            log.info("MusicSheetReader.CreateMusicSheet", e);
         }
     }
 
@@ -498,7 +498,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                 const filenameSplits: string[] = filename.split(".", 1);
                 this.musicSheet.Title = new Label(filenameSplits[0]);
             } catch (ex) {
-                Logging.log("MusicSheetReader.pushSheetLabels: ", ex);
+                log.info("MusicSheetReader.pushSheetLabels: ", ex);
             }
 
         }
@@ -747,7 +747,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                                                 const result: number = <number>parseFloat(instrumentElement.value);
                                                 subInstrument.volume = result / 127.0;
                                             } catch (ex) {
-                                                Logging.debug("ExpressionReader.readExpressionParameters", "read volume", ex);
+                                                log.debug("ExpressionReader.readExpressionParameters", "read volume", ex);
                                             }
 
                                         } else if (instrumentElement.name === "pan") {
@@ -755,18 +755,18 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                                                 const result: number = <number>parseFloat(instrumentElement.value);
                                                 subInstrument.pan = result / 64.0;
                                             } catch (ex) {
-                                                Logging.debug("ExpressionReader.readExpressionParameters", "read pan", ex);
+                                                log.debug("ExpressionReader.readExpressionParameters", "read pan", ex);
                                             }
 
                                         }
                                     } catch (ex) {
-                                        Logging.log("MusicSheetReader.createInstrumentGroups midi settings: ", ex);
+                                        log.info("MusicSheetReader.createInstrumentGroups midi settings: ", ex);
                                     }
 
                                 }
                             }
                         } catch (ex) {
-                            Logging.log("MusicSheetReader.createInstrumentGroups: ", ex);
+                            log.info("MusicSheetReader.createInstrumentGroups: ", ex);
                         }
 
                     }

+ 5 - 5
src/MusicalScore/ScoreIO/VoiceGenerator.ts

@@ -19,7 +19,7 @@ import { NoteEnum } from "../../Common/DataObjects/Pitch";
 import { Staff } from "../VoiceData/Staff";
 import { StaffEntryLink } from "../VoiceData/StaffEntryLink";
 import { VerticalSourceStaffEntryContainer } from "../VoiceData/VerticalSourceStaffEntryContainer";
-import { Logging } from "../../Common/Logging";
+import * as log from "loglevel";
 import { Pitch } from "../../Common/DataObjects/Pitch";
 import { IXmlAttribute } from "../../Common/FileIO/Xml";
 import { CollectionUtil } from "../../Util/CollectionUtil";
@@ -109,7 +109,7 @@ export class VoiceGenerator {
               measureStartAbsoluteTimestamp: Fraction, maxTieNoteFraction: Fraction, chord: boolean, guitarPro: boolean): Note {
     this.currentStaffEntry = parentStaffEntry;
     this.currentMeasure = parentMeasure;
-    //Logging.debug("read called:", restNote);
+    //log.debug("read called:", restNote);
     try {
       this.currentNote = restNote
         ? this.addRestNote(noteDuration)
@@ -331,7 +331,7 @@ export class VoiceGenerator {
    * @returns {Note}
    */
   private addSingleNote(node: IXmlElement, noteDuration: Fraction, graceNote: boolean, chord: boolean, guitarPro: boolean): Note {
-    //Logging.debug("addSingleNote called");
+    //log.debug("addSingleNote called");
     let noteAlter: AccidentalEnum = AccidentalEnum.NONE;
     let noteStep: NoteEnum = NoteEnum.C;
     let noteOctave: number = 0;
@@ -376,7 +376,7 @@ export class VoiceGenerator {
                 }
               }
             } catch (ex) {
-              Logging.log("VoiceGenerator.addSingleNote read Step: ", ex.message);
+              log.info("VoiceGenerator.addSingleNote read Step: ", ex.message);
             }
 
           }
@@ -398,7 +398,7 @@ export class VoiceGenerator {
           }
         }
       } catch (ex) {
-        Logging.log("VoiceGenerator.addSingleNote: ", ex);
+        log.info("VoiceGenerator.addSingleNote: ", ex);
       }
     }
 

+ 2 - 2
src/MusicalScore/SubInstrument.ts

@@ -1,6 +1,6 @@
 import {Instrument} from "./Instrument";
 import {MidiInstrument} from "./VoiceData/Instructions/ClefInstruction";
-import {Logging} from "../Common/Logging";
+import * as log from "loglevel";
 
 export class SubInstrument {
 
@@ -112,7 +112,7 @@ export class SubInstrument {
                 }
             }
         } catch (e) {
-            Logging.error("Error parsing MIDI Instrument. Default to Grand Piano.");
+            log.error("Error parsing MIDI Instrument. Default to Grand Piano.");
         }
         return "unnamed";
     }

+ 2 - 2
src/MusicalScore/VoiceData/Expressions/InstantaniousDynamicExpression.ts

@@ -3,7 +3,7 @@ import {MultiExpression} from "./MultiExpression";
 import {DynamicExpressionSymbolEnum} from "./DynamicExpressionSymbolEnum";
 //import {ArgumentOutOfRangeException} from "../../Exceptions";
 import {InvalidEnumArgumentException} from "../../Exceptions";
-import {Logging} from "../../../Common/Logging";
+import * as log from "loglevel";
 
 export class InstantaniousDynamicExpression extends AbstractExpression {
     constructor(dynamicExpression: string, soundDynamics: number, placement: PlacementEnum, staffNumber: number) {
@@ -143,7 +143,7 @@ export class InstantaniousDynamicExpression extends AbstractExpression {
         //    length += FontInfo.Info.getBoundingBox(symbol).Width;
         //}
         //return length;
-        Logging.debug("[Andrea] instantaniousDynamicExpression: not implemented: calculateLength!");
+        log.debug("[Andrea] instantaniousDynamicExpression: not implemented: calculateLength!");
         return 0.0;
     }
 

+ 1 - 1
src/MusicalScore/VoiceData/SourceMeasure.ts

@@ -214,7 +214,7 @@ export class SourceMeasure extends BaseIdClass {
                 }
             }
         }
-        //Logging.debug("created new container: ", staffEntry, this.verticalSourceStaffEntryContainers);
+        //log.debug("created new container: ", staffEntry, this.verticalSourceStaffEntryContainers);
         return {createdNewContainer: true, staffEntry: staffEntry};
     }