Skip to content

Bill-Lea/Logging

Repository files navigation

📜 other templates available at https://github.com/SkyrimScripting/SKSE_Templates

SKSE - Write to Log File


A simple SKSE plugin for Skyrim using:

  • C++
  • CMake
  • CommonLibSSE NG
    • automatically downloaded using vcpkg integration of CMake

Because this uses CommonLibSSE NG, it supports Skyrim SSE, AE, GOG, and VR!

What does it do?

It writes to a log file.

Read plugin.cpp and logger_annotated.h for more details on what it's doing!

I highly recommend you create a log file for your mod.

It's useful for:

  • your own debugging, while developing the mod
  • debugging issues from your users (ask your users to provide .log files in their bug reports on Nexus/GitHub!)

Logging in your own mods

Just use this template!

Or:

  1. Copy the contents of logger.h
  2. Paste the code at the top of your own plugin.cpp
  3. Call SetupLog(); inside of your SKSEPluginLoad
  4. Bam! Done. Use logger::info("We did it!");

Or:

  1. Copy the logger.h file from this template into your own mod
  2. Write #include "logger.h" in your main plugin.cpp file
  3. Call SetupLog(); inside of your SKSEPluginLoad
  4. Bam! Done. Use logger::info("We did it!");

If you plan on using a debugger and would like to see your logs appear inside of your IDE's Debug Console, then use logger_with_debugger_support.h instead of logger.h.

Requirements

  • Visual Studio 2022 (the free Community edition is fine!)
  • CMake 3.25.1+ (please install the Latest Release)
  • vcpkg
      1. Clone the repository using git OR download it as a .zip
      1. Go into the vcpkg folder and double-click on bootstrap-vcpkg.bat
      1. Edit your system or user Environment Variables and add a new one:
      • Name: VCPKG_ROOT
        Value: C:\path\to\wherever\your\vcpkg\folder\is

Once you have Visual Studio 2022 installed, you can open this folder in basically any C++ editor, e.g. VS Code or CLion or Visual Studio

  • for VS Code, if you are not automatically prompted to install the C++ and CMake Tools extensions, please install those and then close VS Code and then open this project as a folder in VS Code

You may need to click OK on a few windows, but the project should automatically run CMake!

It will automatically download CommonLibSSE NG and everything you need to get started making your new plugin!

Project setup

By default, when this project compiles it will output a .dll for your SKSE plugin into the build/ folder.

If you want to configure this project to output your plugin files into your Skyrim Special Edition's "Data" folder:

  • Set the SKYRIM_FOLDER environment variable to the path of your Skyrim installation
    e.g. C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition

If you want to configure this project to output your plugin files into your "mods" folder:
(for Mod Organizer 2 or Vortex)

  • Set the SKYRIM_MODS_FOLDER environment variable to the path of your mods folder:
    e.g. C:\Users\<user>\AppData\Local\ModOrganizer\Skyrim Special Edition\mods
    e.g. C:\Users\<user>\AppData\Roaming\Vortex\skyrimse\mods

Setup your own repository

If you clone this template on GitHub, please:

  • Go into LICENSE and change the year and change <YOUR NAME HERE> to your name.
  • Go into CODE_OF_CONDUCT.md and change <YOUR CONTACT INFO HERE> to your contact information.

It's good to have a Code of Conduct and GitHub will show your project's CODE_OF_CONDUCT.md in the project sidebar.

If you'd like to know more about open source licenses, see:

If you use this template, PLEASE release your project as a public open source project. 💖

PLEASE DO NOT RELEASE YOUR SKSE PLUGIN ON NEXUS/ETC WITHOUT MAKING THE SOURCE CODE AVAILABLE

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published