"use strict";(globalThis.webpackChunk_elliemae_pui_diagnostics=globalThis.webpackChunk_elliemae_pui_diagnostics||[]).push([[1432],{116:(e,n,i)=>{i.d(n,{R:()=>t,x:()=>a});var s=i(758);const o={},r=s.createContext(o);function t(e){const n=s.useContext(r);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:t(e.components),s.createElement(r.Provider,{value:n},e.children)}},9951:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>g,frontMatter:()=>t,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"api/functions/logger","title":"logger()","description":"create logger","source":"@site/docs/api/functions/logger.md","sourceDirName":"api/functions","slug":"/api/functions/logger","permalink":"/diagnostics/api/functions/logger","draft":false,"unlisted":false,"editUrl":"https://git.elliemae.io/platform-ui/pui-diagnostics.git/docs/api/functions/logger.md","tags":[],"version":"current","frontMatter":{},"sidebar":"docsSidebar","previous":{"title":"logUnhandledErrors()","permalink":"/diagnostics/api/functions/logUnhandledErrors"},"next":{"title":"parentApp()","permalink":"/diagnostics/api/functions/parentApp"}}');var o=i(6070),r=i(116);const t={},a="logger()",l={},c=[{value:"Parameters",id:"parameters",level:2},{value:"options",id:"options",level:3},{value:"Returns",id:"returns",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"logger",children:"logger()"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"function logger(options: LoggerOptions): Logger;\n"})}),"\n",(0,o.jsx)(n.p,{children:"create logger"}),"\n",(0,o.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,o.jsx)(n.h3,{id:"options",children:"options"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"/diagnostics/api/type-aliases/LoggerOptions",children:(0,o.jsx)(n.code,{children:"LoggerOptions"})})}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"/diagnostics/api/type-aliases/LoggerOptions",children:"LoggerOptions"})}),"\n",(0,o.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"/diagnostics/api/type-aliases/Logger",children:(0,o.jsx)(n.code,{children:"Logger"})})}),"\n",(0,o.jsx)(n.p,{children:"instance of logger"}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"// assuming pui-diagnostics javascript is added already to your HTML document\nconst { logger, http, logUnhandledErrors, webvitals } = window.emuiDiagnostics || {};\nif (logger) {\n  const appLogger = logger({\n    transport: http('https://int.api.ellielabs.com/diagnostics/v2/logging'),\n    index: 'myapp',\n    team: 'my team',\n    appName: 'Hello World App',\n  });\n\n  webvitals(appLogger);\n  logUnhandledErrors(appLogger);\n  appLogger.info('application launched');\n} else console.warn('ui logger missing');\n"})})]})}function g(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}}}]);