helper-gib
Helper functions in TypeScript. Used in conjunction with developing Alexa Skills with ask-gib, but may be useful otherwise.
ask-gib for authoring Alexa Skills in TypeScript.
See alsoInstallation
Install with npm:
npm install --save helper-gib
Import ES6 style:
;; // If you want to use the helper scoped to the file.
Usage
Logging
tl;d
;; h.debug"Yo debug message here.", lc;// [201825 10:15:5.692][debug][Foo.eee] Yo debug message here. h.info"Helpful info here, default logPriority is 1", lc;// [201825 10:15:5.697][info][Foo.eee] Helpful info here, default logPriority is 1 h.warn"Hmmm, you sure about that?", lc;// [201825 10:15:5.697][warn][Foo.eee] Hmmm, you sure about that? h.error"Danger Will Robinson!", lc;// [201825 10:15:5.698][error][Foo.eee] Danger Will Robinson!
Basics
Logging is either done or not done based on h.logPriority
value. Sugared functions use default priority values.
So this:
h.debug"Yo debug message here.", lc;
is sugar for this:
h.log"Yo debug message here.", "debug", h.defaultDebugLogPriority, lc;
Errors are always logged, no matter what the logPriority is set at, or what logPriority is passed in. (Honestly, I can't remember why I kept around the logPriority with errors.)
Usage in an Alexa Skill class
If you want something slightly more powerful, this will give you a little more of an idea.
; ;