If you run your application now, you will likely see an error that the SwiftyBeaver configuration file is missing. Let’s add that now
The configuration consist of an array of destinations located in Config/swiftybeaver.json file. Here is an example of a simple SwiftyBeaver configuration file to configure console, file and swiftybeaver platform destinations with their required properties.
SwiftyBeaver Logging Provider for Vapor
Adds the powerful logging of SwiftyBeaver to Vapor for server-side Swift 4 on Linux and Mac.
Installation
Add this project to the
Package.swift
dependencies of your Vapor project:Setup
After you’ve added the SwiftyBeaver Provider package to your project, setting the provider up in code is easy.
You can configure your SwiftyBeaver instance in a pure swift way or using a JSON file like Vapor 2 do,
Register using a pure swift way
Register using a JSON file
First, register the SwiftyBeaverProvider in your
configure.swift
file.Configure Destinations
If you run your application now, you will likely see an error that the SwiftyBeaver configuration file is missing. Let’s add that now
The configuration consist of an array of destinations located in
Config/swiftybeaver.json
file. Here is an example of a simple SwiftyBeaver configuration file to configure console, file and swiftybeaver platform destinations with their required properties.Aditional options:
Use
Please also see the SwiftyBeaver destination docs and how to set a custom logging format.
Output to Xcode 8 Console
Learn more about colored logging to Xcode 8 Console.
Output to File
Learn more about logging to file which is great for Terminal.app fans or to store logs on disk.
Output to Cloud & Mac App
Learn more about logging to the SwiftyBeaver Platform during release!
Learn More
Get support via Github Issues, email and our public Slack channel.
Credits
This package is developed and maintained by Gustavo Perdomo with the collaboration of all vapor community.
License
SwiftyBeaverProvider is released under the MIT License.