---
title: "addLogHandler(_:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtllogstate/addloghandler(_:)"
---

# addLogHandler(_:)

Adds a log handler to customize the presentation of shader logging.

## Declaration

```swift
func addLogHandler(_ block: @escaping @Sendable (String?, String?, MTLLogLevel, String) -> Void)
```

## Mentioned in

Logging shader debug messages

## Discussion

Discussion In absence of any log handlers, all messages goes through the unified log system and are available through the console.app, log tool, or Xcode. Use this method to add your own shader logging presentation or filter messages using subsystem, category and levels. For more details on how to configure your logging, see Generating Log Messages from Your Code.
