πLWC Transaction Management
Learn how Triton manages LWC transactions and logging sessions, including automatic transaction management and best practices.
Automatic Transaction Management
connectedCallback() {
this.triton = new Triton();
// Transaction ID is automatically managed
}Transaction Storage and Caching
export default class LogDemo extends LightningElement {
triton;
async handleOperation() {
try {
// Log the start of operation
this.triton.log(
this.triton.info(TYPE.FRONTEND, AREA.ACCOUNTS)
.summary('Operation started')
);
// Perform some async operation
await this.performOperation();
// Log successful completion
this.triton.log(
this.triton.info(TYPE.FRONTEND, AREA.ACCOUNTS)
.summary('Operation completed successfully')
);
} catch (error) {
// Log any errors that occur
this.triton.log(
this.triton.exception(error)
.summary('Operation failed')
);
}
}
}Auto-Flush Mechanism
Transaction Methods
Best Practices
Last updated