-
Notifications
You must be signed in to change notification settings - Fork 0
Extending
Pt edited this page Jun 17, 2026
·
2 revisions
Lc is modular by design.
You can extend parser strategy, event orchestration, command semantics, and operational instrumentation independently.
- parser implementation,
- command handlers,
- event hooks,
- scope schema,
- logging format and export.
Implement:
Parse(code string) ([]stringParsing.ParsedNode, error)Parse(code []byte) ([]byteParsing.ParsedBytes, error)
Inject with builder:
WithStringParser(...)WithByteParser(...)
Production recommendation:
- pin parser contracts with dedicated conformance tests.
Register handlers with:
UEP.Event.NewEvent(name, handler)
Common industrial use cases:
- policy gates,
- audit logging,
- metrics and tracing wrappers,
- output post-processing.
UEP.Scope is dynamic; discipline is essential.
Recommended:
- central key constants,
- stable value types per key,
- validation at handler boundaries,
- avoid collisions with runtime-reserved keys.
When adding handlers:
- validate inputs early,
- separate validation/execution/output logic,
- return explicit errors instead of hidden failures,
- keep output deterministic.
Use context-aware APIs:
ProcessStringWithCtxProcessBytesWithCtx
This enables deadline/cancellation propagation from your outer system.
core.Logger supports:
- custom default format via
NewLogger(format), - status-level format overrides via
Logger.Statuses, - in-memory aggregation via
Logger.LogandGetLog().
- stabilize parser + command contracts,
- define runtime pipeline points,
- add audit/metrics hooks,
- enforce scope schema,
- run integration tests with cancellation and fault scenarios.