MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / estimateLogSizeInBytes

Function estimateLogSizeInBytes

packages/core/src/client.ts:1780–1789  ·  view source on GitHub ↗

* Estimate the size of a log in bytes. * * @param log - The log to estimate the size of. * @returns The estimated size of the log in bytes.

(log: Log)

Source from the content-addressed store, hash-verified

1778 * @returns The estimated size of the log in bytes.
1779 */
1780function estimateLogSizeInBytes(log: Log): number {
1781 let weight = 0;
1782
1783 // Estimate byte size of 2 bytes per character. This is a rough estimate JS strings are stored as UTF-16.
1784 if (log.message) {
1785 weight += log.message.length * 2;
1786 }
1787
1788 return weight + estimateAttributesSizeInBytes(log.attributes);
1789}
1790
1791/**
1792 * Estimate the size of attributes in bytes.

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected