Created
March 21, 2017 07:02
-
-
Save adamauckland/6c991c0b19a4420df8574c0b208f26d8 to your computer and use it in GitHub Desktop.
Revisions
-
adamauckland created this gist
Mar 21, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ // Requires Node V8 // // Put this script in a directory, then do: // // $ npm init // $ npm install cornerstonelabs-semantic-logging --save // $ node index.js --harmony // // // // Import Semantic Logger ( https://github.com/CornerstoneLabs/semantic-logging ) // var semanticLogging = require("cornerstonelabs-semantic-logging"); // // create a dummy class which implements the logging // class DummyClass extends semanticLogging.SemanticLogger { constructor (request) { super (request); } @info initialising () {}; @info started () {}; @error startFailed () {}; } // // Rename the class to SpecialLogger // Object.defineProperty(DummyClass, "name", "SpecialLogger"); // // SemanticLogger logs the target.constructor.name in the decorator, so this should log as SpecialLogger. // var logger = new SpecialLogger(); logger.info();