Skip to content

feat: Logger - #2747

Merged
iwoplaza merged 19 commits into
mainfrom
feat/logger
Jul 29, 2026
Merged

feat: Logger#2747
iwoplaza merged 19 commits into
mainfrom
feat/logger

Conversation

@aleksanderkatan

@aleksanderkatan aleksanderkatan commented Jul 21, 2026

Copy link
Copy Markdown
Member

Since the vast majority of our console.*() were console.warns, I decided to only define logger.warn and to skip other methods. Let me know if you think this is the right direction for us.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/eslint-plugin-typegpu@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/tgpu-gen@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/tinyest-for-wgsl@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/typegpu@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/color@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/gl@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/radiance-cascades@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/sdf@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/three@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@2c270a2b273a37134166c8c42ee8ab7e9fad5a8b

benchmark
view benchmark

commit
view commit

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Resolution Time Benchmark

---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.97, 2.00, 4.35, 6.73, 7.39, 11.90, 22.13, 25.88]
  line [0.97, 1.89, 4.11, 6.77, 8.03, 11.89, 23.40, 23.25]
  line [0.98, 2.00, 4.46, 6.61, 8.11, 11.32, 22.26, 25.94]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.31, 0.53, 0.68, 0.85, 1.14, 1.21, 1.44, 1.57]
  line [0.30, 0.52, 0.70, 0.87, 1.16, 1.20, 1.47, 1.62]
  line [0.32, 0.58, 0.74, 0.85, 1.19, 1.24, 1.48, 1.73]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.81, 2.12, 3.76, 6.94, 12.49, 25.73, 55.27, 112.03]
  line [0.75, 2.05, 4.08, 6.82, 12.89, 26.17, 54.66, 111.75]
  line [1.00, 2.09, 4.16, 6.72, 13.11, 27.21, 57.87, 118.40]
Loading

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Bundle size comparison (import * as ... in PR vs import * as ... in target):

🟢 Decreased (max -0.75%) ➖ Unchanged 🔴 Increased (max 2.16%) ❔ Unknown
1 36 285 0

import * as ... in PR vs import * as ... in target (did bundle size increase?):

Click to reveal the results table (202 entries).
Test tsdown
d_bool.ts 13.49 kB ($${\color{red}+2.2\%}$$)
d_f16.ts 13.49 kB ($${\color{red}+2.2\%}$$)
d_f32.ts 13.49 kB ($${\color{red}+2.2\%}$$)
d_i32.ts 13.49 kB ($${\color{red}+2.2\%}$$)
d_u32.ts 13.49 kB ($${\color{red}+2.2\%}$$)
d_u16.ts 13.51 kB ($${\color{red}+2.2\%}$$)
d_textureDepth2d.ts 13.93 kB ($${\color{red}+2.1\%}$$)
d_textureDepthCube.ts 13.94 kB ($${\color{red}+2.1\%}$$)
d_texture1d.ts 13.94 kB ($${\color{red}+2.1\%}$$)
d_texture2d.ts 13.94 kB ($${\color{red}+2.1\%}$$)
d_texture3d.ts 13.94 kB ($${\color{red}+2.1\%}$$)
d_textureCube.ts 13.95 kB ($${\color{red}+2.1\%}$$)
d_textureDepth2dArray.ts 13.95 kB ($${\color{red}+2.1\%}$$)
d_textureDepthCubeArray.ts 13.96 kB ($${\color{red}+2.1\%}$$)
d_textureDepthMultisampled2d.ts 13.96 kB ($${\color{red}+2.1\%}$$)
d_texture2dArray.ts 13.96 kB ($${\color{red}+2.1\%}$$)
d_textureCubeArray.ts 13.97 kB ($${\color{red}+2.1\%}$$)
d_textureMultisampled2d.ts 13.97 kB ($${\color{red}+2.1\%}$$)
std_isBeingTranspiled.ts 14.88 kB ($${\color{red}+2.0\%}$$)
std_getTargetShaderLanguage.ts 14.94 kB ($${\color{red}+2.0\%}$$)
std_extensionEnabled.ts 15.00 kB ($${\color{red}+2.0\%}$$)
std_range.ts 15.26 kB ($${\color{red}+2.0\%}$$)
std_discard.ts 14.78 kB ($${\color{red}+2.0\%}$$)
d_disarrayOf.ts 15.43 kB ($${\color{red}+2.0\%}$$)
std_copy.ts 15.02 kB ($${\color{red}+1.9\%}$$)
std_arrayLength.ts 15.03 kB ($${\color{red}+1.9\%}$$)
std_dpdx.ts 15.74 kB ($${\color{red}+1.8\%}$$)
std_dpdxCoarse.ts 15.75 kB ($${\color{red}+1.8\%}$$)
std_dpdxFine.ts 15.75 kB ($${\color{red}+1.8\%}$$)
std_dpdy.ts 15.75 kB ($${\color{red}+1.8\%}$$)
std_dpdyCoarse.ts 15.75 kB ($${\color{red}+1.8\%}$$)
std_dpdyFine.ts 15.75 kB ($${\color{red}+1.8\%}$$)
std_fwidth.ts 15.75 kB ($${\color{red}+1.8\%}$$)
std_fwidthCoarse.ts 15.75 kB ($${\color{red}+1.8\%}$$)
std_fwidthFine.ts 15.75 kB ($${\color{red}+1.8\%}$$)
std_atomicLoad.ts 16.54 kB ($${\color{red}+1.8\%}$$)
std_atomicStore.ts 16.55 kB ($${\color{red}+1.8\%}$$)
std_textureBarrier.ts 16.55 kB ($${\color{red}+1.8\%}$$)
std_atomicAdd.ts 16.55 kB ($${\color{red}+1.8\%}$$)
std_atomicAnd.ts 16.55 kB ($${\color{red}+1.8\%}$$)
std_atomicMax.ts 16.55 kB ($${\color{red}+1.8\%}$$)
std_atomicMin.ts 16.55 kB ($${\color{red}+1.8\%}$$)
std_atomicOr.ts 16.55 kB ($${\color{red}+1.8\%}$$)
std_atomicSub.ts 16.55 kB ($${\color{red}+1.8\%}$$)
std_atomicXor.ts 16.55 kB ($${\color{red}+1.8\%}$$)
std_storageBarrier.ts 16.55 kB ($${\color{red}+1.8\%}$$)
std_workgroupBarrier.ts 16.55 kB ($${\color{red}+1.8\%}$$)
d_vec2b.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec2f.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec2h.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec2i.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec2u.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec3b.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec3f.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec3h.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec3i.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec3u.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec4b.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec4f.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec4h.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec4i.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_vec4u.ts 19.93 kB ($${\color{red}+1.5\%}$$)
d_formatToWGSLType.ts 21.43 kB ($${\color{red}+1.4\%}$$)
d_uint8.ts 21.43 kB ($${\color{red}+1.4\%}$$)
d_float16.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_float16x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_float16x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_float32.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_float32x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_float32x3.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_float32x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_sint16.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_sint16x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_sint16x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_sint32.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_sint32x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_sint32x3.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_sint32x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_sint8.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_sint8x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_sint8x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_snorm16.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_snorm16x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_snorm16x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_snorm8.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_snorm8x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_snorm8x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_uint16.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_uint16x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_uint16x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_uint32.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_uint32x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_uint32x3.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_uint32x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_uint8x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_uint8x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_unorm10_10_10_2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_unorm16.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_unorm16x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_unorm16x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_unorm8.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_unorm8x2.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_unorm8x4.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_unorm8x4_bgra.ts 21.44 kB ($${\color{red}+1.4\%}$$)
d_packedFormats.ts 21.45 kB ($${\color{red}+1.4\%}$$)
d_isPackedData.ts 21.50 kB ($${\color{red}+1.4\%}$$)
d_alignmentOf.ts 22.38 kB ($${\color{red}+1.4\%}$$)
std_subgroupAdd.ts 24.88 kB ($${\color{red}+1.2\%}$$)
std_subgroupAll.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupAnd.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupAny.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupBallot.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupBroadcast.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupBroadcastFirst.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupElect.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupExclusiveAdd.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupExclusiveMul.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupInclusiveAdd.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupInclusiveMul.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupMax.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupMin.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupMul.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupOr.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupShuffle.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupShuffleDown.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupShuffleUp.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupShuffleXor.ts 24.89 kB ($${\color{red}+1.2\%}$$)
std_subgroupXor.ts 24.89 kB ($${\color{red}+1.2\%}$$)
d_sizeOf.ts 25.16 kB ($${\color{red}+1.2\%}$$)
d_isContiguous.ts 25.17 kB ($${\color{red}+1.2\%}$$)
d_getLongestContiguousPrefix.ts 25.18 kB ($${\color{red}+1.2\%}$$)
d_isBuiltin.ts 25.11 kB ($${\color{red}+1.2\%}$$)
std_textureDimensions.ts 26.49 kB ($${\color{red}+1.1\%}$$)
std_textureGather.ts 26.49 kB ($${\color{red}+1.1\%}$$)
std_textureLoad.ts 26.50 kB ($${\color{red}+1.1\%}$$)
std_textureSample.ts 26.50 kB ($${\color{red}+1.1\%}$$)
std_textureSampleBaseClampToEdge.ts 26.50 kB ($${\color{red}+1.1\%}$$)
std_textureSampleBias.ts 26.50 kB ($${\color{red}+1.1\%}$$)
std_textureSampleCompare.ts 26.50 kB ($${\color{red}+1.1\%}$$)
std_textureSampleCompareLevel.ts 26.50 kB ($${\color{red}+1.1\%}$$)
std_textureSampleGrad.ts 26.50 kB ($${\color{red}+1.1\%}$$)
std_textureSampleLevel.ts 26.50 kB ($${\color{red}+1.1\%}$$)
std_textureStore.ts 26.50 kB ($${\color{red}+1.1\%}$$)
d_arrayOf.ts 26.60 kB ($${\color{red}+1.1\%}$$)
d_size.ts 26.85 kB ($${\color{red}+1.1\%}$$)
d_align.ts 26.85 kB ($${\color{red}+1.1\%}$$)
d_location.ts 26.85 kB ($${\color{red}+1.1\%}$$)
d_interpolate.ts 26.85 kB ($${\color{red}+1.1\%}$$)
d_invariant.ts 27.22 kB ($${\color{red}+1.1\%}$$)
std_identity4.ts 27.55 kB ($${\color{red}+1.1\%}$$)
d_mat4x4f.ts 27.55 kB ($${\color{red}+1.1\%}$$)
d_mat2x2f.ts 27.55 kB ($${\color{red}+1.1\%}$$)
d_mat3x3f.ts 27.55 kB ($${\color{red}+1.1\%}$$)
std_identity2.ts 27.55 kB ($${\color{red}+1.1\%}$$)
std_identity3.ts 27.55 kB ($${\color{red}+1.1\%}$$)
std_rotationX4.ts 27.55 kB ($${\color{red}+1.1\%}$$)
std_rotationY4.ts 27.55 kB ($${\color{red}+1.1\%}$$)
std_rotationZ4.ts 27.55 kB ($${\color{red}+1.1\%}$$)
std_scaling4.ts 27.55 kB ($${\color{red}+1.1\%}$$)
d_matToArray.ts 27.68 kB ($${\color{red}+1.1\%}$$)
std_translation4.ts 27.55 kB ($${\color{red}+1.1\%}$$)
d_builtin.ts 29.06 kB ($${\color{red}+1.0\%}$$)
std_pack2x16float.ts 36.59 kB ($${\color{red}+0.8\%}$$)
std_pack4x8unorm.ts 36.59 kB ($${\color{red}+0.8\%}$$)
std_unpack2x16float.ts 36.59 kB ($${\color{red}+0.8\%}$$)
std_unpack4x8unorm.ts 36.59 kB ($${\color{red}+0.8\%}$$)
common_fullScreenTriangle.ts 40.89 kB ($${\color{red}+0.8\%}$$)
common_writeSoA.ts 41.72 kB ($${\color{red}+0.7\%}$$)
d_memoryLayoutOf.ts 42.48 kB ($${\color{red}+0.7\%}$$)
std_bitcastF32toU32.ts 47.35 kB ($${\color{red}+0.6\%}$$)
std_bitcastU32toF32.ts 47.36 kB ($${\color{red}+0.6\%}$$)
std_bitcastU32toI32.ts 47.36 kB ($${\color{red}+0.6\%}$$)
std_bitcast.ts 47.36 kB ($${\color{red}+0.6\%}$$)
std_neg.ts 49.16 kB ($${\color{red}+0.6\%}$$)
std_add.ts 49.17 kB ($${\color{red}+0.6\%}$$)
std_bitShiftLeft.ts 49.17 kB ($${\color{red}+0.6\%}$$)
std_bitShiftRight.ts 49.17 kB ($${\color{red}+0.6\%}$$)
std_div.ts 49.17 kB ($${\color{red}+0.6\%}$$)
std_mod.ts 49.17 kB ($${\color{red}+0.6\%}$$)
std_mul.ts 49.17 kB ($${\color{red}+0.6\%}$$)
std_sub.ts 49.17 kB ($${\color{red}+0.6\%}$$)
std_rotateX4.ts 50.00 kB ($${\color{red}+0.6\%}$$)
std_scale4.ts 50.00 kB ($${\color{red}+0.6\%}$$)
std_translate4.ts 50.00 kB ($${\color{red}+0.6\%}$$)
std_rotateY4.ts 50.01 kB ($${\color{red}+0.6\%}$$)
std_rotateZ4.ts 50.01 kB ($${\color{red}+0.6\%}$$)
std_and.ts 52.75 kB ($${\color{red}+0.6\%}$$)
std_or.ts 52.75 kB ($${\color{red}+0.6\%}$$)
std_all.ts 52.75 kB ($${\color{red}+0.6\%}$$)
std_allEq.ts 52.75 kB ($${\color{red}+0.6\%}$$)
std_eq.ts 52.75 kB ($${\color{red}+0.6\%}$$)
std_lt.ts 52.75 kB ($${\color{red}+0.6\%}$$)
std_ne.ts 52.75 kB ($${\color{red}+0.6\%}$$)
std_not.ts 52.75 kB ($${\color{red}+0.6\%}$$)
std_select.ts 52.75 kB ($${\color{red}+0.6\%}$$)
std_any.ts 52.76 kB ($${\color{red}+0.6\%}$$)
std_ge.ts 52.76 kB ($${\color{red}+0.6\%}$$)
std_gt.ts 52.76 kB ($${\color{red}+0.6\%}$$)
std_isCloseTo.ts 52.76 kB ($${\color{red}+0.6\%}$$)
std_le.ts 52.76 kB ($${\color{red}+0.6\%}$$)
STATIC_common.ts 57.65 kB ($${\color{red}+0.5\%}$$)
d_ref.ts 4.89 kB ($${\color{green}-0.8\%}$$)

import { ... } in PR vs import * as ... in PR (is the library tree-Shakeable?):

Test tsdown
tgpu_init.ts 259.52 kB ($${\color{green}-3.2\%}$$)
tgpu_initFromDevice.ts 258.99 kB ($${\color{green}-3.4\%}$$)
tgpu_resolve.ts 164.93 kB ($${\color{green}-38.5\%}$$)
tgpu_resolveWithContext.ts 164.87 kB ($${\color{green}-38.5\%}$$)
tgpu_bindGroupLayout.ts 69.27 kB ($${\color{green}-74.2\%}$$)
tgpu_mutableAccessor.ts 66.27 kB ($${\color{green}-75.3\%}$$)
tgpu_accessor.ts 66.26 kB ($${\color{green}-75.3\%}$$)
tgpu_privateVar.ts 65.61 kB ($${\color{green}-75.5\%}$$)
tgpu_workgroupVar.ts 65.60 kB ($${\color{green}-75.5\%}$$)
tgpu_const.ts 64.85 kB ($${\color{green}-75.8\%}$$)
tgpu_fn.ts 38.45 kB ($${\color{green}-85.7\%}$$)
tgpu_fragmentFn.ts 38.45 kB ($${\color{green}-85.7\%}$$)
tgpu_vertexFn.ts 38.27 kB ($${\color{green}-85.7\%}$$)
tgpu_computeFn.ts 37.97 kB ($${\color{green}-85.8\%}$$)
tgpu_vertexLayout.ts 27.08 kB ($${\color{green}-89.9\%}$$)
tgpu_comptime.ts 14.77 kB ($${\color{green}-94.5\%}$$)
tgpu_unroll.ts 1.66 kB ($${\color{green}-99.4\%}$$)
tgpu_slot.ts 1.54 kB ($${\color{green}-99.4\%}$$)
tgpu_lazy.ts 1.19 kB ($${\color{green}-99.6\%}$$)

If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.

Comment thread packages/typegpu/src/tgsl/conversion.ts
Comment thread packages/typegpu/src/tgpuLogger.ts
@aleksanderkatan

Copy link
Copy Markdown
Member Author

@pullfrog review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

One bug should be fixed before merge: the warning prefix contains a stray } in tgpuLogger.ts. A couple of smaller cleanups noted inline.

Reviewed changes — Added a central TgpuLogger that categorizes and optionally suppresses warnings, replaced or adjusted existing console.warn/console.error calls, and exposed a warn control API for consumers.

  • Added packages/typegpu/src/tgpuLogger.ts with type-tagged warnings, disable/reset, and dev/prod-mode defaults.
  • Replaced console.warn calls across pipeline, resolve, root init, texture, data I/O, and TGSL modules with logger.warn(...) carrying warning categories.
  • Added warn named export from indexNamedExports.ts.
  • Removed an unintended console.log from data/ref.ts and downgraded some console.error calls to categorized warnings.
  • Updated tests to snapshot the new warning prefix format and added tgpuLogger.test.ts.

⚠️ One console.warn in shared/meta.ts was not migrated

packages/typegpu/src/shared/meta.ts:26 still calls console.warn directly for duplicate-version detection, so it bypasses the new logger and cannot be silenced through warn.disable(...) or controlled by dev/prod defaults. If module-load ordering allows it, route it through logger.warn(...) too.

Technical details
# One console.warn in shared/meta.ts was not migrated

## Affected sites
- `packages/typegpu/src/shared/meta.ts:26` — raw `console.warn` for duplicate TypeGPU version

## Required outcome
- All runtime warnings go through `TgpuLogger` so they respect `warn.disable(...)` and dev/prod defaults.

## Suggested approach
- Import `logger` from `../../tgpuLogger.ts` and replace the `console.warn` call with a categorized warning.
- Verify that importing `tgpuLogger.ts` this early does not create a circular dependency; it currently depends only on `shared/env.ts`.

## Open questions for the human
- Is the duplicate-version warning intentionally left as a raw `console.warn` because it fires before the logger is initialized? If so, document why it is exempted.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/typegpu/src/tgpuLogger.ts Outdated
Comment thread packages/typegpu/src/tgsl/conversion.ts
Comment thread packages/typegpu/tests/internal/tgpuLogger.test.ts Outdated
Comment thread apps/typegpu-docs/src/content/docs/apis/utils.mdx Outdated
@aleksanderkatan
aleksanderkatan marked this pull request as ready for review July 22, 2026 11:23
Copilot AI review requested due to automatic review settings July 22, 2026 11:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The logger migration is mostly complete, but two call sites need attention: meta.ts still calls console.warn directly, and a previously console.error failure message is now routed through a prod-silenced logger.warn. Addressing them before merge keeps the warning surface consistent.

Reviewed changes — PR #2747 introduces a centralized TgpuLogger/warn API for typed, disableable warnings and migrates existing console.warn calls across pipelines, resolve, IO, and TGSL modules.

  • Add TgpuLogger singleton in packages/typegpu/src/tgpuLogger.ts with per-warning-type enable/disable/reset controls and dev/prod warning sets.
  • Export warn as public API from packages/typegpu/src/indexNamedExports.ts and document it in apps/typegpu-docs/src/content/docs/apis/utils.mdx.
  • Replace console.warn calls with typed logger.warn(...) calls in compute/render pipelines, limit checks, indirect-buffer validation, resolution, texture mipmaps, data IO, compiled IO, TGSL conversion, and console-log generation.
  • Replace one warn with invariant for the empty restrictTo array case in tgsl/conversion.ts.

⚠️ Duplicate-version warning in meta.ts bypasses the new logger

The duplicate-version check in packages/typegpu/src/shared/meta.ts:26 still calls console.warn directly. This leaves it un-typed, not disableable via warn.disable(...), and outside the dev/prod filtering policy the rest of the codebase now follows.

Technical details
# Duplicate-version warning in `meta.ts` bypasses the new logger

## Affected sites
- `packages/typegpu/src/shared/meta.ts:26` — duplicate-version warning still calls `console.warn` directly.

## Required outcome
- This warning should be emitted through the centralized `logger` so it participates in the type/disable/reset/prod-filtering scheme, or the author should confirm it is intentionally exempt.

## Suggested approach
- Import `logger` from `./tgpuLogger.ts` in `meta.ts`.
- Pick a suitable warning type (e.g. `suspicious`) or introduce a new type if the team wants it visible in production.
- If it must always fire in production, add that type to `TgpuLogger`'s prod-enabled set and explain why it is special.

## Open questions for the human
- Should duplicate-version detection be disableable, or should it always be surfaced?

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/typegpu/src/data/dataIO.ts
Comment thread packages/typegpu/src/tgpuLogger.ts Outdated
@aleksanderkatan

Copy link
Copy Markdown
Member Author

I was suggested to use a system of reverse DNS system, like com.typegpu.deprecated.flush. Silencing com.typegpu.deprecated would get rid of all sub-errors, but you could also just silence the specific warn. What do you think @reczkok @iwoplaza @cieplypolar? Is this overkill for our case?

@reczkok reczkok left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, love the feature

Comment thread packages/typegpu/src/tgsl/conversion.ts
@iwoplaza
iwoplaza merged commit 7cb746f into main Jul 29, 2026
8 checks passed
@iwoplaza
iwoplaza deleted the feat/logger branch July 29, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants