Advertisement
lim6112j

typescript log function

May 26th, 2020
3,729
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import * as util from 'util';
  2. const log = (function() {
  3.   return function(msg: string) {
  4.     return function(v: any) {
  5.       console.log(msg, " => ",v);
  6.     };
  7.   }
  8. })();
  9. const logl = (function() {
  10.   return function(msg: string) {
  11.     return function(v: any) {
  12.       console.log(msg, " => ", util.inspect(v, true, 10, true));
  13.     };
  14.   }
  15. })();
  16. const proLog = (function() {
  17.   return function(msg: string) {
  18.     return function(v: any) {
  19.       v.then(log(msg));
  20.     }
  21.   }
  22. }
  23. )();
  24. export {log, proLog, logl}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement