Core Principles

Understanding the foundational goals and principles of effective Triton logging implementation across Salesforce technologies.

Goals & Principles

Effective logging with Triton is built on seven core principles that ensure your logs are consistent, useful, and maintainable:

1. Consistency First

Every log must carry consistent metadata (Category, Type, Area, Level, TransactionId, Operation/Function, Context). This consistency enables powerful filtering, grouping, and analysis across your entire org.

2. Context-Rich

Prefer builder + template patterns to capture who/what/where/when/how (user, related objects, stack/operation, runtime info, duration). Rich context transforms logs from simple messages into powerful debugging tools.

3. Standards-Driven

Enforce a Type/Area taxonomy org-wide. Don't invent ad-hoc strings. Use the established enums and extend them systematically when needed.

4. Right Level, Right Volume

Use Level appropriately; rely on Triton's dynamic filtering (e.g., via metadata) rather than hard-coding if/else conditions. This allows you to tune verbosity by environment without code changes.

5. Safe & Useful

Never log secrets/PII. Do log correlation identifiers, IDs, and performance signals. Balance security with debugging value.

6. Transaction-Aware

Start/Resume/Stop transactions across LWC β†’ Apex β†’ Flow boundaries to correlate events end-to-end. This creates complete execution traces across technology boundaries.

7. Buffer Smartly

Use Triton buffering + auto-flush for performance; flush at boundaries and on errors. This optimizes performance while ensuring critical logs are never lost.

Why These Principles Matter

These principles work together to create a logging system that:

  • Scales with your org: Consistent patterns work across teams and technologies

  • Provides actionable insights: Rich context enables effective debugging and monitoring

  • Maintains performance: Smart buffering and filtering keep overhead minimal

  • Enables correlation: Transaction awareness creates end-to-end visibility

  • Supports compliance: Proper handling of sensitive data and audit requirements

Implementation Philosophy

The principles guide implementation decisions:

  • Templates over convenience methods: Templates ensure consistency and reduce drift

  • Context over brevity: More context is better than less, within reason

  • Standards over flexibility: Consistent taxonomy enables powerful analysis

  • Performance awareness: Buffer appropriately and flush strategically

  • Security first: Never compromise security for debugging convenience

By following these principles, you'll create a logging system that grows with your org and provides lasting value for debugging, monitoring, and compliance.

Last updated