Solved LogToFile method usage?

Discussion in 'Rust Development' started by Manvaril, Mar 5, 2018.

  1. I can't seem to find any info on this method, I am trying to use it to replace the old ConVar.Server.Log one and it keeps pointing to "\oxide\logs\" and when you specify a path ie: "/oxide/data/<plugin name/" any info on this method would be good. I'm trying to save log info into a text file so I can review it later
     
  2. Code:
    Puts();
    Puts should print it onto the log file
     
  3. Wulf

    Wulf Community Admin

    That isn't for a custom log file.

    For logging to custom file, take a look at the Logger plugin for an example: uMod - Logger.
     
  4. I got the LogToFile method from Logger, logger makes log files in it's folder ie: oxide/logs/Logger/ and LogToFile also prepends the plugin name to the file ie: logger_

    I need to make a log file and put it in the data folder with a custom file name, I will also need to put ones in folders in the data folder ie: data/pluginname/customdir/customfile.txt
     
  5. Wulf

    Wulf Community Admin

    The only method is what you already have from Logger, it doesn't support a directory under that; it's pretty basic right now.
     
  6. is there anything that can do what I'm asking for it to do? I know ConVar.Server.Log was able to do this
     
  7. Wulf

    Wulf Community Admin

    No, not via a plugin. I'm sure the LogToFile method we provide will be improved on though eventually.
     
  8. would it be possible to use System.IO.File.WriteAllText? or StreamWriter?
     
  9. Wulf

    Wulf Community Admin

    No, those are not allowed via plugins for security purposes. They could be used via an extension, but most hosts do not allow those in most cases.
     
  10. is there a way to use a json file like other plugins use in their /data/ folders? would you be able to use a folder structure in that /data/ folder
     
  11. Wulf

    Wulf Community Admin

    Yes, you can store a .json file under oxide/data/customdirectory using the DataFile API with Oxide.