Solved LogToFile example?

Discussion in 'Rust Discussion' started by DEUSNEXUS, Oct 27, 2017.

  1. LogToFile does not work, are there any examples?
     
  2. Wulf

    Wulf Community Admin

    LogToFile works great, see the Logger plugin for an example.
     
  3. okay, thx
     
  4. Code:
    private static void Log(Kill kill)
            {
                var log = $"[{kill.AttackerID}]{kill.AttackerName} kill [{kill.VictimID}]{kill.VictimName}";
                if (!string.IsNullOrEmpty(kill.Weapon))
                    log += $" [{kill.Weapon}]";            if (kill.Distance != 0)
                    log += $" [{Math.Round(kill.Distance, 2)} m.]";            if (!string.IsNullOrEmpty(kill.BodyPart))
                    log += $" [{kill.BodyPart}]";            LogToFile("oxide/logs/NexusKills.txt", log);
            }

    what am I doing wrong?
    I have an error, or I'm already sleeping
     
  5. Wulf

    Wulf Community Admin

    LogToFile("kills", log);
     
  6. thx, it was necessary to add more ",this"
    LogToFile("kills", log, this);