# Log

> Logs message to the Unity Console using default logger.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## Log(LogType, Object)

Logs `message` to the Unity Console using default logger.

```csharp
public void Log(LogType logType, object message)
```

### Parameters

**** (\[LogType]\(/engine/6000.7/script-reference/unityengine/logtype)): The type of the log message.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): String or object to be converted to string representation for display.

### Remarks

Additional Resources: [ILogger](/engine/6000.7/script-reference/unityengine/ilogger.md), [ILogHandler](/engine/6000.7/script-reference/unityengine/iloghandler.md).

### Examples

```csharp
using UnityEngine;
using System.Collections;

public class MyGameClass : MonoBehaviour
{
    private static ILogger logger = Debug.unityLogger;
    private static string kTAG = "MyGameTag";

    void MyGameMethod()
    {
        logger.Log(kTAG, "Hello");

        Debug.unityLogger.Log(kTAG, "World");

        logger.Log("Hello Logger");
    }
}
```

## Log(LogType, Object, Object)

Logs `message` to the Unity Console using default logger.

```csharp
public void Log(LogType logType, object message, Object context)
```

### Parameters

**** (\[LogType]\(/engine/6000.7/script-reference/unityengine/logtype)): The type of the log message.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): String or object to be converted to string representation for display.**** (\[Object]\(/engine/6000.7/script-reference/unityengine/object)): Object to which the message applies.

### Remarks

Additional Resources: [ILogger](/engine/6000.7/script-reference/unityengine/ilogger.md), [ILogHandler](/engine/6000.7/script-reference/unityengine/iloghandler.md).

### Examples

```csharp
using UnityEngine;
using System.Collections;

public class MyGameClass : MonoBehaviour
{
    private static ILogger logger = Debug.unityLogger;
    private static string kTAG = "MyGameTag";

    void MyGameMethod()
    {
        logger.Log(kTAG, "Hello");

        Debug.unityLogger.Log(kTAG, "World");

        logger.Log("Hello Logger");
    }
}
```

## Log(LogType, string, Object)

Logs `message` to the Unity Console using default logger.

```csharp
public void Log(LogType logType, string tag, object message)
```

### Parameters

**** (\[LogType]\(/engine/6000.7/script-reference/unityengine/logtype)): The type of the log message.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Used to identify the source of a log message. It usually identifies the class where the log call occurs.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): String or object to be converted to string representation for display.

### Remarks

Additional Resources: [ILogger](/engine/6000.7/script-reference/unityengine/ilogger.md), [ILogHandler](/engine/6000.7/script-reference/unityengine/iloghandler.md).

### Examples

```csharp
using UnityEngine;
using System.Collections;

public class MyGameClass : MonoBehaviour
{
    private static ILogger logger = Debug.unityLogger;
    private static string kTAG = "MyGameTag";

    void MyGameMethod()
    {
        logger.Log(kTAG, "Hello");

        Debug.unityLogger.Log(kTAG, "World");

        logger.Log("Hello Logger");
    }
}
```

## Log(LogType, string, Object, Object)

Logs `message` to the Unity Console using default logger.

```csharp
public void Log(LogType logType, string tag, object message, Object context)
```

### Parameters

**** (\[LogType]\(/engine/6000.7/script-reference/unityengine/logtype)): The type of the log message.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Used to identify the source of a log message. It usually identifies the class where the log call occurs.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): String or object to be converted to string representation for display.**** (\[Object]\(/engine/6000.7/script-reference/unityengine/object)): Object to which the message applies.

### Remarks

Additional Resources: [ILogger](/engine/6000.7/script-reference/unityengine/ilogger.md), [ILogHandler](/engine/6000.7/script-reference/unityengine/iloghandler.md).

### Examples

```csharp
using UnityEngine;
using System.Collections;

public class MyGameClass : MonoBehaviour
{
    private static ILogger logger = Debug.unityLogger;
    private static string kTAG = "MyGameTag";

    void MyGameMethod()
    {
        logger.Log(kTAG, "Hello");

        Debug.unityLogger.Log(kTAG, "World");

        logger.Log("Hello Logger");
    }
}
```

## Log(Object)

Logs `message` to the Unity Console using default logger.

```csharp
public void Log(object message)
```

### Parameters

**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): String or object to be converted to string representation for display.

### Remarks

Additional Resources: [ILogger](/engine/6000.7/script-reference/unityengine/ilogger.md), [ILogHandler](/engine/6000.7/script-reference/unityengine/iloghandler.md).

### Examples

```csharp
using UnityEngine;
using System.Collections;

public class MyGameClass : MonoBehaviour
{
    private static ILogger logger = Debug.unityLogger;
    private static string kTAG = "MyGameTag";

    void MyGameMethod()
    {
        logger.Log(kTAG, "Hello");

        Debug.unityLogger.Log(kTAG, "World");

        logger.Log("Hello Logger");
    }
}
```

## Log(string, Object)

Logs `message` to the Unity Console using default logger.

```csharp
public void Log(string tag, object message)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Used to identify the source of a log message. It usually identifies the class where the log call occurs.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): String or object to be converted to string representation for display.

### Remarks

Additional Resources: [ILogger](/engine/6000.7/script-reference/unityengine/ilogger.md), [ILogHandler](/engine/6000.7/script-reference/unityengine/iloghandler.md).

### Examples

```csharp
using UnityEngine;
using System.Collections;

public class MyGameClass : MonoBehaviour
{
    private static ILogger logger = Debug.unityLogger;
    private static string kTAG = "MyGameTag";

    void MyGameMethod()
    {
        logger.Log(kTAG, "Hello");

        Debug.unityLogger.Log(kTAG, "World");

        logger.Log("Hello Logger");
    }
}
```

## Log(string, Object, Object)

Logs `message` to the Unity Console using default logger.

```csharp
public void Log(string tag, object message, Object context)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Used to identify the source of a log message. It usually identifies the class where the log call occurs.**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): String or object to be converted to string representation for display.**** (\[Object]\(/engine/6000.7/script-reference/unityengine/object)): Object to which the message applies.

### Remarks

Additional Resources: [ILogger](/engine/6000.7/script-reference/unityengine/ilogger.md), [ILogHandler](/engine/6000.7/script-reference/unityengine/iloghandler.md).

### Examples

```csharp
using UnityEngine;
using System.Collections;

public class MyGameClass : MonoBehaviour
{
    private static ILogger logger = Debug.unityLogger;
    private static string kTAG = "MyGameTag";

    void MyGameMethod()
    {
        logger.Log(kTAG, "Hello");

        Debug.unityLogger.Log(kTAG, "World");

        logger.Log("Hello Logger");
    }
}
```
