PageSourceSearch

https://backstage.io/assets/js/235ce86a.b8a71872.js

js backstage.io collected 2026-09-24 08:28:46 UTC 3,034 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkbackstage_microsite=self.webpackChunkbackstage_microsite||[]).push([["16111"],{567625(e,n,t){t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>d,frontMatter:()=>c,metadata:()=>r,toc:()=>l});var r=t(713425),s=t(474848),i=t(28453);let c={id:"logger",title:"Logger Service",sidebar_label:"Logger",description:"Documentation for the Logger service"},o,a={},l=[{value:"Using the service",id:"using-the-service",level:2}];function g(e){let n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.p,{children:"This service allows plugins to output logging information. There are actually two logger services: a root logger, and a plugin logger which is bound to individual plugins, so that you will get nice messages with the plugin ID referenced in the log lines."}),"\n",(0,s.jsx)(n.h2,{id:"using-the-service",children:"Using the service"}),"\n",(0,s.jsxs)(n.p,{children:["The following example shows how to get the logger in your ",(0,s.jsx)(n.code,{children:"example"})," backend plugin and create a warning message that will be printed nicely to the console."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import {\n  coreServices,\n  createBackendPlugin,\n} from '@backstage/backend-plugin-api';\n\ncreateBackendPlugin({\n  pluginId: 'example',\n  register(env) {\n    env.registerInit({\n      deps: {\n        log: coreServices.logger,\n      },\n      async init({ log }) {\n        log.warn(\"Here's a nice log line that's a warning!\");\n      },\n    });\n  },\n});\n"})})]})}function d(e={}){let{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(g,{...e})}):g(e)}},28453(e,n,t){t.d(n,{R:()=>c,x:()=>o});var r=t(296540);let s={},i=r.createContext(s);function c(e){let n=r.useContext(i);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),r.createElement(i.Provider,{value:n},e.children)}},713425(e){e.exports=JSON.parse('{"id":"backend-system/core-services/logger","title":"Logger Service","description":"Documentation for the Logger service","source":"@site/../docs/backend-system/core-services/logger.md","sourceDirName":"backend-system/core-services","slug":"/backend-system/core-services/logger","permalink":"/docs/next/backend-system/core-services/logger","draft":false,"unlisted":false,"editUrl":"https://github.com/backstage/backstage/edit/master/docs/backend-system/core-services/logger.md","tags":[],"version":"current","frontMatter":{"id":"logger","title":"Logger Service","sidebar_label":"Logger","description":"Documentation for the Logger service"},"sidebar":"docs","previous":{"title":"Lifecycle","permalink":"/docs/next/backend-system/core-services/lifecycle"},"next":{"title":"Metrics Service (alpha)","permalink":"/docs/next/backend-system/core-services/metrics"}}')}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.