@lssm/example.lifecycle-cli 0.0.0-canary-20251217062139 → 0.0.0-canary-20251217072406

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +202 -195
  2. package/.turbo/turbo-build.log +203 -18
  3. package/CHANGELOG.md +6 -5
  4. package/dist/bundles/lifecycle-managed/dist/agents/lifecycle-advisor-agent.js +67 -2
  5. package/dist/bundles/lifecycle-managed/dist/api/rest-handlers.js +22 -1
  6. package/dist/bundles/lifecycle-managed/dist/events/lifecycle-events.js +1 -1
  7. package/dist/bundles/lifecycle-managed/dist/index.js +4 -1
  8. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/agent/agent-factory.js +1 -1
  9. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/agent/contract-spec-agent.js +14 -1
  10. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/agent/index.js +2 -1
  11. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/approval/index.js +1 -1
  12. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/approval/workflow.js +1 -1
  13. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/index.js +14 -1
  14. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/schema/index.js +2 -1
  15. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/schema/json-schema-to-zod.js +1 -1
  16. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/schema/schema-output.js +3 -1
  17. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/spec/spec.js +23 -1
  18. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/tools/index.js +4 -1
  19. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/tools/knowledge-tool.js +2 -1
  20. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/tools/mcp-client.js +2 -1
  21. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/tools/mcp-server.js +3 -1
  22. package/dist/bundles/lifecycle-managed/dist/libs/ai-agent/dist/tools/tool-adapter.js +2 -1
  23. package/dist/bundles/lifecycle-managed/dist/libs/analytics/dist/churn/index.js +1 -1
  24. package/dist/bundles/lifecycle-managed/dist/libs/analytics/dist/churn/predictor.js +1 -1
  25. package/dist/bundles/lifecycle-managed/dist/libs/analytics/dist/cohort/index.js +1 -1
  26. package/dist/bundles/lifecycle-managed/dist/libs/analytics/dist/cohort/tracker.js +1 -1
  27. package/dist/bundles/lifecycle-managed/dist/libs/analytics/dist/index.js +4 -1
  28. package/dist/bundles/lifecycle-managed/dist/libs/lifecycle/dist/index.js +4 -1
  29. package/dist/bundles/lifecycle-managed/dist/libs/lifecycle/dist/types/axes.js +28 -1
  30. package/dist/bundles/lifecycle-managed/dist/libs/lifecycle/dist/types/milestones.js +1 -1
  31. package/dist/bundles/lifecycle-managed/dist/libs/lifecycle/dist/types/signals.js +1 -1
  32. package/dist/bundles/lifecycle-managed/dist/libs/lifecycle/dist/types/stages.js +15 -1
  33. package/dist/bundles/lifecycle-managed/dist/libs/lifecycle/dist/utils/formatters.js +1 -1
  34. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/index.js +7 -1
  35. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/intent/detector.js +1 -1
  36. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/lifecycle/dist/index.js +4 -1
  37. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/lifecycle/dist/types/milestones.js +1 -1
  38. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/lifecycle/dist/types/signals.js +1 -1
  39. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/lifecycle/dist/types/stages.js +143 -1
  40. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/lifecycle/dist/utils/formatters.js +7 -1
  41. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/logging/index.js +38 -1
  42. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/metrics/index.js +20 -1
  43. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/pipeline/evolution-pipeline.js +2 -1
  44. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/pipeline/lifecycle-pipeline.js +73 -1
  45. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/tracing/index.js +1 -1
  46. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/tracing/middleware.js +2 -1
  47. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/ceremony/ceremony-designer.js +17 -1
  48. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/data/library-stage-map.js +90 -1
  49. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/data/stage-playbooks.js +240 -1
  50. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/index.js +3 -1
  51. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/libs/lifecycle/dist/index.js +4 -1
  52. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/libs/lifecycle/dist/types/milestones.js +1 -1
  53. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/libs/lifecycle/dist/types/signals.js +1 -1
  54. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/libs/lifecycle/dist/types/stages.js +143 -1
  55. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/libs/lifecycle/dist/utils/formatters.js +1 -1
  56. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/recommendations/library-recommender.js +19 -1
  57. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/recommendations/recommendation-engine.js +46 -1
  58. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/collectors/signal-collector.js +65 -1
  59. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/data/milestones-catalog.js +73 -1
  60. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/data/stage-weights.js +169 -1
  61. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/index.js +3 -1
  62. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/libs/lifecycle/dist/index.js +4 -1
  63. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/libs/lifecycle/dist/types/axes.js +28 -1
  64. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/libs/lifecycle/dist/types/milestones.js +1 -1
  65. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/libs/lifecycle/dist/types/signals.js +1 -1
  66. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/libs/lifecycle/dist/types/stages.js +143 -1
  67. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/libs/lifecycle/dist/utils/formatters.js +1 -1
  68. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/orchestrator/lifecycle-orchestrator.js +53 -1
  69. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/planning/milestone-planner.js +16 -1
  70. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-core/dist/scoring/stage-scorer.js +64 -1
  71. package/dist/bundles/lifecycle-managed/dist/services/assessment-service.js +72 -1
  72. package/dist/demo.js +53 -1
  73. package/dist/docs/index.js +1 -1
  74. package/dist/docs/lifecycle-cli.docblock.js +31 -14
  75. package/dist/example.js +37 -1
  76. package/dist/index.js +5 -1
  77. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
  78. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
  79. package/dist/libs/contracts/dist/docs/index.js +29 -1
  80. package/dist/libs/contracts/dist/docs/presentations.js +71 -1
  81. package/dist/libs/contracts/dist/docs/registry.js +44 -1
  82. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
  83. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
  84. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
  85. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
  86. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
  87. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
  88. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
  89. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
  90. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
  91. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
  92. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
  93. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
  94. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
  95. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
  96. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
  97. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
  98. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
  99. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
  100. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
  101. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
  102. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
  103. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
  104. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
  105. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
  106. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
  107. package/dist/libs/lifecycle/dist/index.js +5 -1
  108. package/dist/libs/lifecycle/dist/types/axes.js +28 -1
  109. package/dist/libs/lifecycle/dist/types/milestones.js +1 -1
  110. package/dist/libs/lifecycle/dist/types/signals.js +1 -1
  111. package/dist/libs/lifecycle/dist/types/stages.js +151 -1
  112. package/dist/libs/lifecycle/dist/utils/formatters.js +1 -1
  113. package/dist/libs/logger/dist/context.node.js +78 -1
  114. package/dist/libs/logger/dist/elysia-plugin.js +3 -1
  115. package/dist/libs/logger/dist/formatters.js +163 -9
  116. package/dist/libs/logger/dist/index.js +7 -1
  117. package/dist/libs/logger/dist/logger.node.js +189 -1
  118. package/dist/libs/logger/dist/timer.js +126 -1
  119. package/dist/libs/logger/dist/tracer.node.js +115 -1
  120. package/dist/libs/logger/dist/types.js +13 -1
  121. package/package.json +8 -7
  122. package/tsconfig.tsbuildinfo +1 -1
  123. package/dist/bundles/lifecycle-managed/dist/libs/observability/dist/lifecycle/dist/types/axes.js +0 -1
  124. package/dist/bundles/lifecycle-managed/dist/modules/lifecycle-advisor/dist/libs/lifecycle/dist/types/axes.js +0 -1
@@ -1 +1,151 @@
1
- let e=function(e){return e[e.Exploration=0]=`Exploration`,e[e.ProblemSolutionFit=1]=`ProblemSolutionFit`,e[e.MvpEarlyTraction=2]=`MvpEarlyTraction`,e[e.ProductMarketFit=3]=`ProductMarketFit`,e[e.GrowthScaleUp=4]=`GrowthScaleUp`,e[e.ExpansionPlatform=5]=`ExpansionPlatform`,e[e.MaturityRenewal=6]=`MaturityRenewal`,e}({});e.Exploration,e.ProblemSolutionFit,e.MvpEarlyTraction,e.ProductMarketFit,e.GrowthScaleUp,e.ExpansionPlatform,e.MaturityRenewal;const t={[e.Exploration]:{id:e.Exploration,order:0,slug:`exploration`,name:`Exploration / Ideation`,question:`Is there a problem worth my time?`,signals:[`20+ discovery interviews`,`Clear problem statement`,`Named ICP`],traps:[`Branding before discovery`,`Premature tooling decisions`],focusAreas:[`Customer discovery`,`Problem definition`,`Segment clarity`]},[e.ProblemSolutionFit]:{id:e.ProblemSolutionFit,order:1,slug:`problem-solution-fit`,name:`Problem–Solution Fit`,question:`Do people care enough about this solution?`,signals:[`Prototype reuse`,`Referral energy`,`Pre-pay interest`],traps:[`“Market is huge” without users`,`Skipping qualitative loops`],focusAreas:[`Solution hypothesis`,`Value messaging`,`Feedback capture`]},[e.MvpEarlyTraction]:{id:e.MvpEarlyTraction,order:2,slug:`mvp-early-traction`,name:`MVP & Early Traction`,question:`Can we get real usage and learn fast?`,signals:[`20–50 named active users`,`Weekly releases`,`Noisy feedback`],traps:[`Overbuilt infra for 10 users`,`Undefined retention metric`],focusAreas:[`Activation`,`Cohort tracking`,`Feedback rituals`]},[e.ProductMarketFit]:{id:e.ProductMarketFit,order:3,slug:`product-market-fit`,name:`Product–Market Fit`,question:`Is this pulling us forward?`,signals:[`Retention without heroics`,`Organic word-of-mouth`,`Value stories`],traps:[`Hero growth that does not scale`,`Ignoring churn signals`],focusAreas:[`Retention`,`Reliability`,`ICP clarity`]},[e.GrowthScaleUp]:{id:e.GrowthScaleUp,order:4,slug:`growth-scale-up`,name:`Growth / Scale-up`,question:`Can we grow this repeatably?`,signals:[`Predictable channels`,`Specialized hires`,`Unit economics on track`],traps:[`Paid spend masking retention gaps`,`Infra debt blocking launches`],focusAreas:[`Ops systems`,`Growth loops`,`Reliability engineering`]},[e.ExpansionPlatform]:{id:e.ExpansionPlatform,order:5,slug:`expansion-platform`,name:`Expansion / Platform`,question:`What is the next growth curve?`,signals:[`Stable core metrics`,`Partner/API demand`,`Ecosystem pull`],traps:[`Platform theater before wedge is solid`],focusAreas:[`Partnerships`,`APIs`,`New market validation`]},[e.MaturityRenewal]:{id:e.MaturityRenewal,order:6,slug:`maturity-renewal`,name:`Maturity / Renewal`,question:`Optimize, reinvent, or sunset?`,signals:[`Margin focus`,`Portfolio bets`,`Narrative refresh`],traps:[`Assuming past success is enough`],focusAreas:[`Cost optimization`,`Reinvention bets`,`Sunset planning`]}};export{e,t as n};
1
+ //#region ../../libs/lifecycle/dist/types/stages.js
2
+ let LifecycleStage = /* @__PURE__ */ function(LifecycleStage$1) {
3
+ LifecycleStage$1[LifecycleStage$1["Exploration"] = 0] = "Exploration";
4
+ LifecycleStage$1[LifecycleStage$1["ProblemSolutionFit"] = 1] = "ProblemSolutionFit";
5
+ LifecycleStage$1[LifecycleStage$1["MvpEarlyTraction"] = 2] = "MvpEarlyTraction";
6
+ LifecycleStage$1[LifecycleStage$1["ProductMarketFit"] = 3] = "ProductMarketFit";
7
+ LifecycleStage$1[LifecycleStage$1["GrowthScaleUp"] = 4] = "GrowthScaleUp";
8
+ LifecycleStage$1[LifecycleStage$1["ExpansionPlatform"] = 5] = "ExpansionPlatform";
9
+ LifecycleStage$1[LifecycleStage$1["MaturityRenewal"] = 6] = "MaturityRenewal";
10
+ return LifecycleStage$1;
11
+ }({});
12
+ const LIFECYCLE_STAGE_ORDER = [
13
+ LifecycleStage.Exploration,
14
+ LifecycleStage.ProblemSolutionFit,
15
+ LifecycleStage.MvpEarlyTraction,
16
+ LifecycleStage.ProductMarketFit,
17
+ LifecycleStage.GrowthScaleUp,
18
+ LifecycleStage.ExpansionPlatform,
19
+ LifecycleStage.MaturityRenewal
20
+ ];
21
+ const LIFECYCLE_STAGE_META = {
22
+ [LifecycleStage.Exploration]: {
23
+ id: LifecycleStage.Exploration,
24
+ order: 0,
25
+ slug: "exploration",
26
+ name: "Exploration / Ideation",
27
+ question: "Is there a problem worth my time?",
28
+ signals: [
29
+ "20+ discovery interviews",
30
+ "Clear problem statement",
31
+ "Named ICP"
32
+ ],
33
+ traps: ["Branding before discovery", "Premature tooling decisions"],
34
+ focusAreas: [
35
+ "Customer discovery",
36
+ "Problem definition",
37
+ "Segment clarity"
38
+ ]
39
+ },
40
+ [LifecycleStage.ProblemSolutionFit]: {
41
+ id: LifecycleStage.ProblemSolutionFit,
42
+ order: 1,
43
+ slug: "problem-solution-fit",
44
+ name: "Problem–Solution Fit",
45
+ question: "Do people care enough about this solution?",
46
+ signals: [
47
+ "Prototype reuse",
48
+ "Referral energy",
49
+ "Pre-pay interest"
50
+ ],
51
+ traps: ["“Market is huge” without users", "Skipping qualitative loops"],
52
+ focusAreas: [
53
+ "Solution hypothesis",
54
+ "Value messaging",
55
+ "Feedback capture"
56
+ ]
57
+ },
58
+ [LifecycleStage.MvpEarlyTraction]: {
59
+ id: LifecycleStage.MvpEarlyTraction,
60
+ order: 2,
61
+ slug: "mvp-early-traction",
62
+ name: "MVP & Early Traction",
63
+ question: "Can we get real usage and learn fast?",
64
+ signals: [
65
+ "20–50 named active users",
66
+ "Weekly releases",
67
+ "Noisy feedback"
68
+ ],
69
+ traps: ["Overbuilt infra for 10 users", "Undefined retention metric"],
70
+ focusAreas: [
71
+ "Activation",
72
+ "Cohort tracking",
73
+ "Feedback rituals"
74
+ ]
75
+ },
76
+ [LifecycleStage.ProductMarketFit]: {
77
+ id: LifecycleStage.ProductMarketFit,
78
+ order: 3,
79
+ slug: "product-market-fit",
80
+ name: "Product–Market Fit",
81
+ question: "Is this pulling us forward?",
82
+ signals: [
83
+ "Retention without heroics",
84
+ "Organic word-of-mouth",
85
+ "Value stories"
86
+ ],
87
+ traps: ["Hero growth that does not scale", "Ignoring churn signals"],
88
+ focusAreas: [
89
+ "Retention",
90
+ "Reliability",
91
+ "ICP clarity"
92
+ ]
93
+ },
94
+ [LifecycleStage.GrowthScaleUp]: {
95
+ id: LifecycleStage.GrowthScaleUp,
96
+ order: 4,
97
+ slug: "growth-scale-up",
98
+ name: "Growth / Scale-up",
99
+ question: "Can we grow this repeatably?",
100
+ signals: [
101
+ "Predictable channels",
102
+ "Specialized hires",
103
+ "Unit economics on track"
104
+ ],
105
+ traps: ["Paid spend masking retention gaps", "Infra debt blocking launches"],
106
+ focusAreas: [
107
+ "Ops systems",
108
+ "Growth loops",
109
+ "Reliability engineering"
110
+ ]
111
+ },
112
+ [LifecycleStage.ExpansionPlatform]: {
113
+ id: LifecycleStage.ExpansionPlatform,
114
+ order: 5,
115
+ slug: "expansion-platform",
116
+ name: "Expansion / Platform",
117
+ question: "What is the next growth curve?",
118
+ signals: [
119
+ "Stable core metrics",
120
+ "Partner/API demand",
121
+ "Ecosystem pull"
122
+ ],
123
+ traps: ["Platform theater before wedge is solid"],
124
+ focusAreas: [
125
+ "Partnerships",
126
+ "APIs",
127
+ "New market validation"
128
+ ]
129
+ },
130
+ [LifecycleStage.MaturityRenewal]: {
131
+ id: LifecycleStage.MaturityRenewal,
132
+ order: 6,
133
+ slug: "maturity-renewal",
134
+ name: "Maturity / Renewal",
135
+ question: "Optimize, reinvent, or sunset?",
136
+ signals: [
137
+ "Margin focus",
138
+ "Portfolio bets",
139
+ "Narrative refresh"
140
+ ],
141
+ traps: ["Assuming past success is enough"],
142
+ focusAreas: [
143
+ "Cost optimization",
144
+ "Reinvention bets",
145
+ "Sunset planning"
146
+ ]
147
+ }
148
+ };
149
+
150
+ //#endregion
151
+ export { LifecycleStage };
@@ -1 +1 @@
1
- import"../types/stages.js";
1
+ import "../types/stages.js";
@@ -1 +1,78 @@
1
- import{AsyncLocalStorage as e}from"node:async_hooks";var t=class t{static instance;storage;constructor(){this.storage=new e}static getInstance(){return t.instance||=new t,t.instance}run(e,t){let n={context:{...e},trace:this.getCurrentTrace()};return this.storage.run(n,t)}extend(e,t){let n={...this.getContext(),...e};return this.run(n,t)}set(e,t){let n=this.storage.getStore();n&&(n.context[e]=t)}get(e){return this.storage.getStore()?.context?.[e]}getContext(){return this.storage.getStore()?.context||{}}setTrace(e){let t=this.storage.getStore();t&&(t.trace=e)}getCurrentTrace(){return this.storage.getStore()?.trace}generateId(){return crypto.randomUUID()}};export{t};
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+
3
+ //#region ../../libs/logger/dist/context.node.mjs
4
+ /**
5
+ * Node.js implementation of LogContext using AsyncLocalStorage.
6
+ */
7
+ var LogContext = class LogContext$1 {
8
+ static instance;
9
+ storage;
10
+ constructor() {
11
+ this.storage = new AsyncLocalStorage();
12
+ }
13
+ static getInstance() {
14
+ if (!LogContext$1.instance) LogContext$1.instance = new LogContext$1();
15
+ return LogContext$1.instance;
16
+ }
17
+ /**
18
+ * Run a function with a new context
19
+ */
20
+ run(context, fn) {
21
+ const contextData = {
22
+ context: { ...context },
23
+ trace: this.getCurrentTrace()
24
+ };
25
+ return this.storage.run(contextData, fn);
26
+ }
27
+ /**
28
+ * Run a function with an extended context (merges with current)
29
+ */
30
+ extend(additionalContext, fn) {
31
+ const mergedContext = {
32
+ ...this.getContext(),
33
+ ...additionalContext
34
+ };
35
+ return this.run(mergedContext, fn);
36
+ }
37
+ /**
38
+ * Set context data for the current execution context
39
+ */
40
+ set(key, value) {
41
+ const current = this.storage.getStore();
42
+ if (current) current.context[key] = value;
43
+ }
44
+ /**
45
+ * Get a specific context value
46
+ */
47
+ get(key) {
48
+ return this.storage.getStore()?.context?.[key];
49
+ }
50
+ /**
51
+ * Get all context data
52
+ */
53
+ getContext() {
54
+ return this.storage.getStore()?.context || {};
55
+ }
56
+ /**
57
+ * Set trace context
58
+ */
59
+ setTrace(trace) {
60
+ const current = this.storage.getStore();
61
+ if (current) current.trace = trace;
62
+ }
63
+ /**
64
+ * Get current trace context
65
+ */
66
+ getCurrentTrace() {
67
+ return this.storage.getStore()?.trace;
68
+ }
69
+ /**
70
+ * Generate a unique ID for requests/operations
71
+ */
72
+ generateId() {
73
+ return crypto.randomUUID();
74
+ }
75
+ };
76
+
77
+ //#endregion
78
+ export { LogContext };
@@ -1 +1,3 @@
1
- import"./context.node.js";import"./logger.node.js";import"elysia";
1
+ import "./context.node.js";
2
+ import "./logger.node.js";
3
+ import "elysia";
@@ -1,9 +1,163 @@
1
- import{e}from"./types.js";const t={reset:`\x1B[0m`,bright:`\x1B[1m`,dim:`\x1B[2m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,magenta:`\x1B[35m`,cyan:`\x1B[36m`,white:`\x1B[37m`,gray:`\x1B[90m`,bgRed:`\x1B[41m`,bgYellow:`\x1B[43m`},n={[e.TRACE]:{color:t.gray,symbol:`○`,name:`TRACE`},[e.DEBUG]:{color:t.blue,symbol:`●`,name:`DEBUG`},[e.INFO]:{color:t.green,symbol:`●`,name:`INFO `},[e.WARN]:{color:t.yellow,symbol:`▲`,name:`WARN `},[e.ERROR]:{color:t.red,symbol:`✖`,name:`ERROR`},[e.FATAL]:{color:t.bgRed+t.white,symbol:`💀`,name:`FATAL`}};var r=class{enableColors;constructor(e=!0){this.enableColors=e}format(e){let r=[],i=n[e.level],a=this.formatTimestamp(e.timestamp);r.push(this.colorize(a,t.gray));let o=`${i.symbol} ${i.name}`;if(r.push(this.colorize(o,i.color)),e.traceId){let n=this.formatTraceInfo(e);r.push(this.colorize(n,t.cyan))}if(r.push(this.colorize(e.message,t.white)),e.duration!==void 0){let n=`(${this.formatDuration(e.duration)})`;r.push(this.colorize(n,t.magenta))}let s=r.join(` `);if(e.context&&Object.keys(e.context).length>0&&(s+=`
2
- `+this.formatContext(e.context)),e.metadata&&Object.keys(e.metadata).length>0&&(s+=`
3
- `+this.formatMetadata(e.metadata)),e.error&&(s+=`
4
- `+this.formatError(e.error)),e.tags&&e.tags.length>0){let n=e.tags.map(e=>`#${e}`).join(` `);s+=`
5
- `+this.colorize(`Tags: ${n}`,t.blue)}return s}formatTimestamp(e){return e.toISOString().substring(11,23)}formatTraceInfo(e){let t=[`trace:${e.traceId?.substring(0,8)||`unknown`}`];return e.spanId&&e.spanId.length>=8&&t.push(`span:${e.spanId.substring(0,8)}`),e.parentId&&e.parentId.length>=8&&t.push(`parent:${e.parentId.substring(0,8)}`),`[${t.join(`|`)}]`}formatDuration(e){return e<1?`${(e*1e3).toFixed(0)}μs`:e<1e3?`${e.toFixed(2)}ms`:`${(e/1e3).toFixed(2)}s`}formatContext(e){let n=this.formatObject(e,2);return this.colorize(`Context: ${n}`,t.cyan)}formatMetadata(e){let n=this.formatObject(e,2);return this.colorize(`Metadata: ${n}`,t.blue)}formatError(e){let n=this.colorize(`Error: ${e.name}: ${e.message}`,t.red);if(e.stack){let r=e.stack.split(`
6
- `).slice(1,6).map(e=>` ${e}`).join(`
7
- `);n+=`
8
- `+this.colorize(r,t.gray)}return n}formatObject(e,t=0){let n=` `.repeat(t),r=Object.entries(e);return r.length===0?`{}`:r[0]&&typeof r[0][1]!=`object`?`{ ${r[0][0]}: ${this.formatValue(r[0][1])} }`:`{\n${r.map(([e,r])=>`${n} ${e}: ${this.formatValue(r,t+2)}`).join(`
9
- `)}\n${n}}`}formatValue(e,t=0){return e===null?`null`:e===void 0?`undefined`:typeof e==`string`?`"${e}"`:typeof e==`boolean`||typeof e==`number`?String(e):e instanceof Date?e.toISOString():Array.isArray(e)?e.length===0?`[]`:`[${e.map(e=>this.formatValue(e)).join(`, `)}]`:typeof e==`object`?this.formatObject(e,t):String(e)}colorize(e,n){return this.enableColors?`${n}${e}${t.reset}`:e}},i=class{format(e){let t={timestamp:e.timestamp,level:e.level,message:e.message};return e.traceId&&(t.traceId=e.traceId),e.spanId&&(t.spanId=e.spanId),e.parentId&&(t.parentId=e.parentId),e.duration!==void 0&&(t.duration=e.duration),e.context&&Object.keys(e.context).length>0&&(t.context=e.context),e.metadata&&Object.keys(e.metadata).length>0&&(t.metadata=e.metadata),e.error&&(t.error={name:e.error.name,message:e.error.message,stack:e.error.stack}),e.tags&&e.tags.length>0&&(t.tags=e.tags),JSON.stringify(t)}};export{i,r};
1
+ import { LogLevel } from "./types.js";
2
+
3
+ //#region ../../libs/logger/dist/formatters.mjs
4
+ const colors = {
5
+ reset: "\x1B[0m",
6
+ bright: "\x1B[1m",
7
+ dim: "\x1B[2m",
8
+ red: "\x1B[31m",
9
+ green: "\x1B[32m",
10
+ yellow: "\x1B[33m",
11
+ blue: "\x1B[34m",
12
+ magenta: "\x1B[35m",
13
+ cyan: "\x1B[36m",
14
+ white: "\x1B[37m",
15
+ gray: "\x1B[90m",
16
+ bgRed: "\x1B[41m",
17
+ bgYellow: "\x1B[43m"
18
+ };
19
+ const levelConfig = {
20
+ [LogLevel.TRACE]: {
21
+ color: colors.gray,
22
+ symbol: "○",
23
+ name: "TRACE"
24
+ },
25
+ [LogLevel.DEBUG]: {
26
+ color: colors.blue,
27
+ symbol: "●",
28
+ name: "DEBUG"
29
+ },
30
+ [LogLevel.INFO]: {
31
+ color: colors.green,
32
+ symbol: "●",
33
+ name: "INFO "
34
+ },
35
+ [LogLevel.WARN]: {
36
+ color: colors.yellow,
37
+ symbol: "▲",
38
+ name: "WARN "
39
+ },
40
+ [LogLevel.ERROR]: {
41
+ color: colors.red,
42
+ symbol: "✖",
43
+ name: "ERROR"
44
+ },
45
+ [LogLevel.FATAL]: {
46
+ color: colors.bgRed + colors.white,
47
+ symbol: "💀",
48
+ name: "FATAL"
49
+ }
50
+ };
51
+ var DevFormatter = class {
52
+ enableColors;
53
+ constructor(enableColors = true) {
54
+ this.enableColors = enableColors;
55
+ }
56
+ format(entry) {
57
+ const parts = [];
58
+ const config = levelConfig[entry.level];
59
+ const timestamp = this.formatTimestamp(entry.timestamp);
60
+ parts.push(this.colorize(timestamp, colors.gray));
61
+ const levelText = `${config.symbol} ${config.name}`;
62
+ parts.push(this.colorize(levelText, config.color));
63
+ if (entry.traceId) {
64
+ const traceInfo = this.formatTraceInfo(entry);
65
+ parts.push(this.colorize(traceInfo, colors.cyan));
66
+ }
67
+ parts.push(this.colorize(entry.message, colors.white));
68
+ if (entry.duration !== void 0) {
69
+ const durationText = `(${this.formatDuration(entry.duration)})`;
70
+ parts.push(this.colorize(durationText, colors.magenta));
71
+ }
72
+ let output = parts.join(" ");
73
+ if (entry.context && Object.keys(entry.context).length > 0) output += "\n" + this.formatContext(entry.context);
74
+ if (entry.metadata && Object.keys(entry.metadata).length > 0) output += "\n" + this.formatMetadata(entry.metadata);
75
+ if (entry.error) output += "\n" + this.formatError(entry.error);
76
+ if (entry.tags && entry.tags.length > 0) {
77
+ const tagsText = entry.tags.map((tag) => `#${tag}`).join(" ");
78
+ output += "\n" + this.colorize(`Tags: ${tagsText}`, colors.blue);
79
+ }
80
+ return output;
81
+ }
82
+ formatTimestamp(timestamp) {
83
+ return timestamp.toISOString().substring(11, 23);
84
+ }
85
+ formatTraceInfo(entry) {
86
+ const parts = [`trace:${entry.traceId?.substring(0, 8) || "unknown"}`];
87
+ if (entry.spanId && entry.spanId.length >= 8) parts.push(`span:${entry.spanId.substring(0, 8)}`);
88
+ if (entry.parentId && entry.parentId.length >= 8) parts.push(`parent:${entry.parentId.substring(0, 8)}`);
89
+ return `[${parts.join("|")}]`;
90
+ }
91
+ formatDuration(duration) {
92
+ if (duration < 1) return `${(duration * 1e3).toFixed(0)}μs`;
93
+ else if (duration < 1e3) return `${duration.toFixed(2)}ms`;
94
+ else return `${(duration / 1e3).toFixed(2)}s`;
95
+ }
96
+ formatContext(context) {
97
+ const formatted = this.formatObject(context, 2);
98
+ return this.colorize(`Context: ${formatted}`, colors.cyan);
99
+ }
100
+ formatMetadata(metadata) {
101
+ const formatted = this.formatObject(metadata, 2);
102
+ return this.colorize(`Metadata: ${formatted}`, colors.blue);
103
+ }
104
+ formatError(error) {
105
+ let output = this.colorize(`Error: ${error.name}: ${error.message}`, colors.red);
106
+ if (error.stack) {
107
+ const indentedStack = error.stack.split("\n").slice(1, 6).map((line) => ` ${line}`).join("\n");
108
+ output += "\n" + this.colorize(indentedStack, colors.gray);
109
+ }
110
+ return output;
111
+ }
112
+ formatObject(obj, indent = 0) {
113
+ const spaces = " ".repeat(indent);
114
+ const entries = Object.entries(obj);
115
+ if (entries.length === 0) return "{}";
116
+ if (entries[0] && typeof entries[0][1] !== "object") return `{ ${entries[0][0]}: ${this.formatValue(entries[0][1])} }`;
117
+ return `{\n${entries.map(([key, value]) => {
118
+ return `${spaces} ${key}: ${this.formatValue(value, indent + 2)}`;
119
+ }).join("\n")}\n${spaces}}`;
120
+ }
121
+ formatValue(value, indent = 0) {
122
+ if (value === null) return "null";
123
+ if (value === void 0) return "undefined";
124
+ if (typeof value === "string") return `"${value}"`;
125
+ if (typeof value === "boolean" || typeof value === "number") return String(value);
126
+ if (value instanceof Date) return value.toISOString();
127
+ if (Array.isArray(value)) {
128
+ if (value.length === 0) return "[]";
129
+ return `[${value.map((v) => this.formatValue(v)).join(", ")}]`;
130
+ }
131
+ if (typeof value === "object") return this.formatObject(value, indent);
132
+ return String(value);
133
+ }
134
+ colorize(text, color) {
135
+ if (!this.enableColors) return text;
136
+ return `${color}${text}${colors.reset}`;
137
+ }
138
+ };
139
+ var ProductionFormatter = class {
140
+ format(entry) {
141
+ const logObject = {
142
+ timestamp: entry.timestamp,
143
+ level: entry.level,
144
+ message: entry.message
145
+ };
146
+ if (entry.traceId) logObject.traceId = entry.traceId;
147
+ if (entry.spanId) logObject.spanId = entry.spanId;
148
+ if (entry.parentId) logObject.parentId = entry.parentId;
149
+ if (entry.duration !== void 0) logObject.duration = entry.duration;
150
+ if (entry.context && Object.keys(entry.context).length > 0) logObject.context = entry.context;
151
+ if (entry.metadata && Object.keys(entry.metadata).length > 0) logObject.metadata = entry.metadata;
152
+ if (entry.error) logObject.error = {
153
+ name: entry.error.name,
154
+ message: entry.error.message,
155
+ stack: entry.error.stack
156
+ };
157
+ if (entry.tags && entry.tags.length > 0) logObject.tags = entry.tags;
158
+ return JSON.stringify(logObject);
159
+ }
160
+ };
161
+
162
+ //#endregion
163
+ export { DevFormatter, ProductionFormatter };
@@ -1 +1,7 @@
1
- import{t as e}from"./context.node.js";import{e as t}from"./types.js";import{e as n}from"./timer.js";import{n as r}from"./tracer.node.js";import{i,r as a}from"./formatters.js";import{o}from"./logger.node.js";import"./elysia-plugin.js";
1
+ import { LogContext } from "./context.node.js";
2
+ import { LogLevel } from "./types.js";
3
+ import { Timer } from "./timer.js";
4
+ import { Tracer } from "./tracer.node.js";
5
+ import { DevFormatter, ProductionFormatter } from "./formatters.js";
6
+ import { Logger } from "./logger.node.js";
7
+ import "./elysia-plugin.js";
@@ -1 +1,189 @@
1
- import{t as e}from"./context.node.js";import{e as t}from"./types.js";import{t as n}from"./timer.js";import{n as r}from"./tracer.node.js";import{i,r as a}from"./formatters.js";var o=class o{config;formatter;context;tracer;timerManager;constructor(o){this.config={level:t.INFO,environment:process.env.NODE_ENV||`development`,enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!0,maxContextDepth:10,timestampFormat:`iso`,...o},this.context=e.getInstance(),this.tracer=new r,this.timerManager=new n,this.formatter=this.config.environment===`production`?new i:new a(this.config.enableColors)}traceLog(e,n){this.log(t.TRACE,e,n)}debug(e,n){this.log(t.DEBUG,e,n)}info(e,n){this.log(t.INFO,e,n)}warn(e,n){this.log(t.WARN,e,n)}error(e,n,r){this.log(t.ERROR,e,n,r)}fatal(e,n,r){this.log(t.FATAL,e,n,r)}withContext(e,t){return this.context.run(e,t)}extendContext(e,t){return this.context.extend(e,t)}setContext(e,t){this.context.set(e,t)}getContext(){return this.context.getContext()}trace=async(e,t)=>this.config.enableTracing?this.tracer.trace(e,t):await t();getTraceId(){return this.tracer.getCurrentTrace()?.traceId}startSpan(e){return this.config.enableTracing?this.tracer.startSpan(e):null}finishSpan(e){if(this.config.enableTracing)return this.tracer.finishSpan(e)}addTraceMetadata(e,t){this.config.enableTracing&&this.tracer.addMetadata(e,t)}addTraceTags(...e){this.config.enableTracing&&this.tracer.addTags(...e)}startTimer(e){return this.config.enableTiming?this.timerManager.start(e):null}stopTimer(e){if(this.config.enableTiming)return this.timerManager.stop(e)}getTimer(e){return this.timerManager.get(e)}child(e){let t=new o(this.config);return Object.entries(e).forEach(([e,n])=>{t.setContext(e,n)}),t}setLevel(e){this.config.level=e}setFormatter(e){this.formatter=e}async profile(e,n,r){let i=this.startTimer(`profile-${e}`),a=performance.now();try{let o=await this.tracer.trace({operationType:`custom`,operationName:`profile:${e}`,autoTiming:!0},n),s=performance.now()-a;i?.stop();let c=r?.logLevel||t.DEBUG;return this.log(c,`Profile: ${e} completed`,{operation:e,duration:`${s.toFixed(2)}ms`,result:r?.logResult?o:`[result hidden]`}),o}catch(t){let n=performance.now()-a;throw i?.stop(),this.error(`Profile: ${e} failed`,{operation:e,duration:`${n.toFixed(2)}ms`,error:t.message},t),t}}logRequest(e,t,n,r){let i=this.getHttpLogLevel(n),a=`${e.toUpperCase()} ${t}${n?` ${n}`:``}`;this.log(i,a,{method:e,url:t,statusCode:n,duration:r?`${r.toFixed(2)}ms`:void 0,type:`http_request`})}async flush(){this.timerManager.clear()}getStats(){return{activeTimers:this.timerManager.getActive().length,activeSpans:this.tracer.getActiveSpans().length,config:{...this.config}}}output(e,n){n>=t.ERROR?console.error(e):console.log(e)}log(e,t,n,r){if(e<this.config.level)return;let i=this.config.enableTracing?this.tracer.getCurrentTrace():void 0,a=this.config.enableContext?this.context.getContext():void 0,o={level:e,message:t,timestamp:new Date,traceId:i?.traceId,parentId:i?.parentId,spanId:i?.spanId,context:a,metadata:n,error:r,tags:i?.tags};i?.metadata?.duration&&(o.duration=i.metadata.duration);let s=this.formatter.format(o);this.output(s,e)}getHttpLogLevel(e){return e?e>=500?t.ERROR:e>=400?t.WARN:t.INFO:t.INFO}};export{o};
1
+ import { LogContext } from "./context.node.js";
2
+ import { LogLevel } from "./types.js";
3
+ import { TimerManager } from "./timer.js";
4
+ import { Tracer } from "./tracer.node.js";
5
+ import { DevFormatter, ProductionFormatter } from "./formatters.js";
6
+
7
+ //#region ../../libs/logger/dist/logger.node.mjs
8
+ var Logger = class Logger$1 {
9
+ config;
10
+ formatter;
11
+ context;
12
+ tracer;
13
+ timerManager;
14
+ constructor(config) {
15
+ this.config = {
16
+ level: LogLevel.INFO,
17
+ environment: process.env.NODE_ENV || "development",
18
+ enableTracing: true,
19
+ enableTiming: true,
20
+ enableContext: true,
21
+ enableColors: true,
22
+ maxContextDepth: 10,
23
+ timestampFormat: "iso",
24
+ ...config
25
+ };
26
+ this.context = LogContext.getInstance();
27
+ this.tracer = new Tracer();
28
+ this.timerManager = new TimerManager();
29
+ this.formatter = this.config.environment === "production" ? new ProductionFormatter() : new DevFormatter(this.config.enableColors);
30
+ }
31
+ traceLog(message, metadata) {
32
+ this.log(LogLevel.TRACE, message, metadata);
33
+ }
34
+ debug(message, metadata) {
35
+ this.log(LogLevel.DEBUG, message, metadata);
36
+ }
37
+ info(message, metadata) {
38
+ this.log(LogLevel.INFO, message, metadata);
39
+ }
40
+ warn(message, metadata) {
41
+ this.log(LogLevel.WARN, message, metadata);
42
+ }
43
+ error(message, metadata, error) {
44
+ this.log(LogLevel.ERROR, message, metadata, error);
45
+ }
46
+ fatal(message, metadata, error) {
47
+ this.log(LogLevel.FATAL, message, metadata, error);
48
+ }
49
+ withContext(context, fn) {
50
+ return this.context.run(context, fn);
51
+ }
52
+ extendContext(additionalContext, fn) {
53
+ return this.context.extend(additionalContext, fn);
54
+ }
55
+ setContext(key, value) {
56
+ this.context.set(key, value);
57
+ }
58
+ getContext() {
59
+ return this.context.getContext();
60
+ }
61
+ trace = async (options, fn) => {
62
+ if (!this.config.enableTracing) return await fn();
63
+ return this.tracer.trace(options, fn);
64
+ };
65
+ getTraceId() {
66
+ return this.tracer.getCurrentTrace()?.traceId;
67
+ }
68
+ startSpan(options) {
69
+ if (!this.config.enableTracing) return null;
70
+ return this.tracer.startSpan(options);
71
+ }
72
+ finishSpan(spanId) {
73
+ if (!this.config.enableTracing) return;
74
+ return this.tracer.finishSpan(spanId);
75
+ }
76
+ addTraceMetadata(key, value) {
77
+ if (this.config.enableTracing) this.tracer.addMetadata(key, value);
78
+ }
79
+ addTraceTags(...tags) {
80
+ if (this.config.enableTracing) this.tracer.addTags(...tags);
81
+ }
82
+ startTimer(id) {
83
+ if (!this.config.enableTiming) return null;
84
+ return this.timerManager.start(id);
85
+ }
86
+ stopTimer(id) {
87
+ if (!this.config.enableTiming) return;
88
+ return this.timerManager.stop(id);
89
+ }
90
+ getTimer(id) {
91
+ return this.timerManager.get(id);
92
+ }
93
+ child(context) {
94
+ const childLogger = new Logger$1(this.config);
95
+ Object.entries(context).forEach(([key, value]) => {
96
+ childLogger.setContext(key, value);
97
+ });
98
+ return childLogger;
99
+ }
100
+ setLevel(level) {
101
+ this.config.level = level;
102
+ }
103
+ setFormatter(formatter) {
104
+ this.formatter = formatter;
105
+ }
106
+ async profile(operationName, fn, options) {
107
+ const timer = this.startTimer(`profile-${operationName}`);
108
+ const startTime = performance.now();
109
+ try {
110
+ const result = await this.tracer.trace({
111
+ operationType: "custom",
112
+ operationName: `profile:${operationName}`,
113
+ autoTiming: true
114
+ }, fn);
115
+ const duration = performance.now() - startTime;
116
+ timer?.stop();
117
+ const logLevel = options?.logLevel || LogLevel.DEBUG;
118
+ this.log(logLevel, `Profile: ${operationName} completed`, {
119
+ operation: operationName,
120
+ duration: `${duration.toFixed(2)}ms`,
121
+ result: options?.logResult ? result : "[result hidden]"
122
+ });
123
+ return result;
124
+ } catch (error) {
125
+ const duration = performance.now() - startTime;
126
+ timer?.stop();
127
+ this.error(`Profile: ${operationName} failed`, {
128
+ operation: operationName,
129
+ duration: `${duration.toFixed(2)}ms`,
130
+ error: error.message
131
+ }, error);
132
+ throw error;
133
+ }
134
+ }
135
+ logRequest(method, url, statusCode, duration) {
136
+ const level = this.getHttpLogLevel(statusCode);
137
+ const message = `${method.toUpperCase()} ${url}${statusCode ? ` ${statusCode}` : ""}`;
138
+ this.log(level, message, {
139
+ method,
140
+ url,
141
+ statusCode,
142
+ duration: duration ? `${duration.toFixed(2)}ms` : void 0,
143
+ type: "http_request"
144
+ });
145
+ }
146
+ async flush() {
147
+ this.timerManager.clear();
148
+ }
149
+ getStats() {
150
+ return {
151
+ activeTimers: this.timerManager.getActive().length,
152
+ activeSpans: this.tracer.getActiveSpans().length,
153
+ config: { ...this.config }
154
+ };
155
+ }
156
+ output(message, level) {
157
+ if (level >= LogLevel.ERROR) console.error(message);
158
+ else console.log(message);
159
+ }
160
+ log(level, message, metadata, error) {
161
+ if (level < this.config.level) return;
162
+ const currentTrace = this.config.enableTracing ? this.tracer.getCurrentTrace() : void 0;
163
+ const contextData = this.config.enableContext ? this.context.getContext() : void 0;
164
+ const entry = {
165
+ level,
166
+ message,
167
+ timestamp: /* @__PURE__ */ new Date(),
168
+ traceId: currentTrace?.traceId,
169
+ parentId: currentTrace?.parentId,
170
+ spanId: currentTrace?.spanId,
171
+ context: contextData,
172
+ metadata,
173
+ error,
174
+ tags: currentTrace?.tags
175
+ };
176
+ if (currentTrace?.metadata?.duration) entry.duration = currentTrace.metadata.duration;
177
+ const formatted = this.formatter.format(entry);
178
+ this.output(formatted, level);
179
+ }
180
+ getHttpLogLevel(statusCode) {
181
+ if (!statusCode) return LogLevel.INFO;
182
+ if (statusCode >= 500) return LogLevel.ERROR;
183
+ if (statusCode >= 400) return LogLevel.WARN;
184
+ return LogLevel.INFO;
185
+ }
186
+ };
187
+
188
+ //#endregion
189
+ export { Logger };