Skip to content

Instantly share code, notes, and snippets.

@MuhammadFaizanKhan
Created April 21, 2020 14:35
Show Gist options
  • Save MuhammadFaizanKhan/74b6bea553619d3dbbd9774dbdaaae21 to your computer and use it in GitHub Desktop.
Save MuhammadFaizanKhan/74b6bea553619d3dbbd9774dbdaaae21 to your computer and use it in GitHub Desktop.
How to use Serilog in Unity3d C#
using UnityEngine;
using Serilog;//Need dll files
public class SerilogDemoInUnity3d : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
var log = new LoggerConfiguration().WriteTo.File(Application.dataPath + "/AppLog.txt").CreateLogger();
//global logger settings
Log.Logger = log;
//some logs
Log.Information("Here is the Information");
Log.Warning("Here is warning");
Log.Error("Here is an error");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment