* 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)
| 1778 | * @returns The estimated size of the log in bytes. |
| 1779 | */ |
| 1780 | function 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. |
nothing calls this directly
no test coverage detected