---
title: "emitEvent(_:id:_:)"
framework: os
role: symbol
role_heading: Instance Method
path: "os/ossignposter/emitevent(_:id:_:)"
---

# emitEvent(_:id:_:)

Marks a point of interest in time and attaches the specified message.

## Declaration

```swift
func emitEvent(_ name: StaticString, id: OSSignpostID = .exclusive, _ message: SignpostMetadata)
```

## Parameters

- `name`: The event’s name.
- `id`: The event’s identifier. The default value is doc://com.apple.os/documentation/os/OSSignpostID/exclusive.
- `message`: The interpolated string that the signposter attaches to the event. Each of the message’s interpolations can specify individual formatting and privacy options. For more information, see doc://com.apple.os/documentation/os/message-argument-formatters.

## Discussion

Discussion important: Don’t create an instance of SignpostMetadata. Instead, provide an interpolated string as the message parameter and the system converts it automatically. You can use the makeSignpostID() and makeSignpostID(from:) methods to generate an identifier for the event, as the following example shows: let accountNumber = "12345678"

// Create a signposter using the default subsystem. let signposter = OSSignposter()          // Generate a signpost ID to associate with the event. let signpostID = signposter.makeSignpostID()          // Emit a named event using the signpost ID and attach a message // that securely interpolates sensitive data. signposter.emitEvent("New Account Created", id: signpostID,     "Account: \(accountNumber, privacy: .sensitive(mask: .hash))")

## See Also

### Emitting Individual Signposts

- [emitEvent(_:id:)](os/ossignposter/emitevent(_:id:).md)
