<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSGraphCompileOptionsSetMessageLogMask(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@BNNSGraphCompileOptionsSetMessageLogMask"
  },
  "title" : "BNNSGraphCompileOptionsSetMessageLogMask(_:_:)"
}
-->

# BNNSGraphCompileOptionsSetMessageLogMask(_:_:)

Sets the mask for compile-time messages.

```
func BNNSGraphCompileOptionsSetMessageLogMask(_ options: bnns_graph_compile_options_t, _ log_level_mask: UInt32)
```

## Parameters

`options`

The compilation options object.

`log_level_mask`

The bit mask of levels that BNNS logs.

## Discussion

The default log mask is [`BNNSGraphMessageLevelUnsupported`](/documentation/Accelerate/BNNSGraphMessageLevelUnsupported) | [`BNNSGraphMessageLevelWarning`](/documentation/Accelerate/BNNSGraphMessageLevelWarning) | [`BNNSGraphMessageLevelError`](/documentation/Accelerate/BNNSGraphMessageLevelError).

The following code adds a custom graph compile-message callback function that prints [`BNNSGraphMessageLevelInfo`](/documentation/Accelerate/BNNSGraphMessageLevelInfo) level messages to the console:

```swift
let options = BNNSGraphCompileOptionsMakeDefault()
defer {
    BNNSGraphCompileOptionsDestroy(options)
}

BNNSGraphCompileOptionsSetMessageLogMask(options, BNNSGraphMessageLevelInfo.rawValue)
BNNSGraphCompileOptionsSetMessageLogCallback(options, messageLogCallback, nil)

func messageLogCallback(msg_level: BNNSGraphMessageLevel,
                        error_msg: UnsafePointer<CChar>,
                        source_location: UnsafePointer<CChar>?,
                        user_message_data_t:UnsafeMutablePointer<user_message_data_t>?) {
    
    print(NSString(cString: error_msg, encoding: NSUTF8StringEncoding) ?? "")
    if let source_location = source_location {
        print(NSString(cString: source_location, encoding: NSUTF8StringEncoding) ?? "")
    }
}
```

---

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)