UNPKG

@kestra-io/libs

Version:

Kestra is an infinitely scalable orchestration and scheduling platform, creating, running, scheduling, and monitoring millions of complex pipelines.

2 lines (1 loc) 693 B
import e from"../logging/console-logger.mjs";const t=function(){};t.format=e=>"::"+JSON.stringify(e).replace(/[\u0085\u2028\u2029]/g,(e=>"\\u"+e.charCodeAt(0).toString(16).padStart(4,"0")))+"::",t._send=e=>{console.log(t.format(e))},t._metrics=(e,s,o,r)=>{t._send({metrics:[{name:e,type:s,value:o,tags:r||{}}]})},t.outputs=e=>{t._send({outputs:e})},t.assets=e=>{t._send({assets:e})},t.counter=(e,s,o)=>{t._metrics(e,"counter",s,o)},t.timer=(e,s,o)=>{if("function"==typeof s){const r=new Date;s((()=>{const s=((new Date).getTime()-r.getTime())/1e3;t._metrics(e,"timer",s,o)}))}else t._metrics(e,"timer",s,o)},t.gauge=(e,s,o)=>{t._metrics(e,"gauge",s,o)},t.logger=()=>new e(t);export default t;