<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTL4CommandBufferOptions/logState",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTL4CommandBufferOptions(py)logState"
  },
  "title" : "logState"
}
-->

# logState

Contains information related to shader logging.

```
var logState: (any MTLLogState)? { get set }
```

## Discussion

To enable shader logging, call [`beginCommandBuffer(allocator:options:)`](/documentation/Metal/MTL4CommandBuffer/beginCommandBuffer(allocator:options:)) with an instance
of [`MTL4CommandBufferOptions`](/documentation/Metal/MTL4CommandBufferOptions) that contains a non-`nil` [`MTLLogState`](/documentation/Metal/MTLLogState) instance in this property.

Shader functions log messages until the command buffer ends.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)