A simple VaporLogger provider for outputting server logs to log files.
Simple File Logger outputs separate files based on the log’s LogLevel. Debug logs are output to debug.log, error logs to error.log, and so on. By default, logs are output to:
Linux
macOS
/var/log/Vapor/
~/Library/Caches/Vapor/
You can change Vapor/ to an arbitrary directory by changing the executableName during setup.
Overview
A simple Vapor
Logger
provider for outputting server logs to log files.Simple File Logger outputs separate files based on the log’s
LogLevel
. Debug logs are output todebug.log
, error logs toerror.log
, and so on. By default, logs are output to:/var/log/Vapor/
~/Library/Caches/Vapor/
You can change
Vapor/
to an arbitrary directory by changing theexecutableName
during setup.Installation
Add this dependency to your
Package.swift
:And add
"SimpleFileLogger"
as a dependency to your app’s target.Setup
In
configure.swift
:To define an executable name and include timestamps, you can provide configuration:
Usage
You can create a logger anywhere in your Vapor application with access to its
Container
with:For example, to log all the requests to your server: