# LogMessage

> Information about a problem that arose while reflecting shader code.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEditor.ShaderApiReflection](/engine/6000.7/script-reference/unityeditor/shaderapireflection.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public struct LogMessage
```

## Remarks

Use this struct to retrieve a data representation of any console messages logged while importing a shader include.

Additional Resources: [ShaderIncludeReflection.LogMessages](/engine/6000.7/script-reference/unityeditor/shaderapireflection/shaderincludereflection/logmessages.md).

## Examples

```csharp
using UnityEditor;
using UnityEditor.ShaderApiReflection;
using UnityEngine;

// This example adds a menu item which re-logs any reflection errors reported by shader includes
// selected in the project view.
public class ShaderIncludeReflectionErrorPrinter
{
    [MenuItem("Examples/ShaderIncludeReflectionErrorPrinter")]
    static void PrintErrors()
    {
        // Visit each selected object
        foreach (Object selectedObject in Selection.objects)
        {
            // Check if the object is a ShaderInclude
            if (selectedObject is ShaderInclude includeObject)
            {
                // Re-log each reflection message
                foreach (LogMessage message in includeObject.Reflection.LogMessages)
                {
                    string formattedMessage =
                        $"{message.ErrorCode} {message.MessageSeverity} at {message.Location.FilePath}"
                        + $" (line {message.Location.Line}): {message.Text}";
                    if (message.MessageSeverity == LogMessage.Severity.Error)
                        Debug.LogError(formattedMessage);
                    else
                        Debug.LogWarning(formattedMessage);
                }
            }
        }
    }
}
```

## Properties

| Property                                                                                                         | Description               |
| ---------------------------------------------------------------------------------------------------------------- | ------------------------- |
| [ErrorCode](/engine/6000.7/script-reference/unityeditor/shaderapireflection/logmessage/errorcode.md)             | The message's error code. |
| [Location](/engine/6000.7/script-reference/unityeditor/shaderapireflection/logmessage/location.md)               | The message's location.   |
| [MessageSeverity](/engine/6000.7/script-reference/unityeditor/shaderapireflection/logmessage/messageseverity.md) | The message's severity.   |
| [Text](/engine/6000.7/script-reference/unityeditor/shaderapireflection/logmessage/text.md)                       | The message's details.    |

## Enums

| Enum                                                                                                          | Description                                          |
| ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| [LogMessage.Severity](/engine/6000.7/script-reference/unityeditor/shaderapireflection/logmessage/severity.md) | The degree of failure associated with a log message. |
