MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / createLogger

Function createLogger

packages/shared/src/logger.ts:42–82  ·  view source on GitHub ↗
(label: string)

Source from the content-addressed store, hash-verified

40});
41
42const createLogger = (label: string) => {
43 const isStructuredLoggingEnabled = env.SOURCEBOT_STRUCTURED_LOGGING_ENABLED === 'true';
44
45 return winston.createLogger({
46 level: env.SOURCEBOT_LOG_LEVEL,
47 format: combine(
48 errors({ stack: true }),
49 timestamp(),
50 labelFn({ label: label }),
51 ),
52 transports: [
53 new winston.transports.Console({
54 format: isStructuredLoggingEnabled
55 ? combine(
56 datadogFormat(),
57 json()
58 )
59 : combine(
60 colorize(),
61 humanReadableFormat
62 ),
63 }),
64 ...(env.SOURCEBOT_STRUCTURED_LOGGING_FILE && isStructuredLoggingEnabled ? [
65 new winston.transports.File({
66 filename: env.SOURCEBOT_STRUCTURED_LOGGING_FILE,
67 format: combine(
68 datadogFormat(),
69 json()
70 ),
71 }),
72 ] : []),
73 ...(env.LOGTAIL_TOKEN && env.LOGTAIL_HOST ? [
74 new LogtailTransport(
75 new Logtail(env.LOGTAIL_TOKEN, {
76 endpoint: env.LOGTAIL_HOST,
77 })
78 )
79 ] : []),
80 ]
81 });
82}
83
84export {
85 createLogger

Callers 15

createJobLoggerFunction · 0.90
gitea.tsFile · 0.90
index.tsFile · 0.90
git.tsFile · 0.90
gitlab.tsFile · 0.90
github.tsFile · 0.90
zoekt.tsFile · 0.90
azuredevops.tsFile · 0.90
gerrit.tsFile · 0.90
instrument.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected