https://github.com/nwestfall/overlogger
Switch or migrate logging services without rewriting all your code
https://github.com/nwestfall/overlogger
android appcenter bugsnag console dotnet ios logging logging-library netstandard xamarin
Last synced: 2 months ago
JSON representation
Switch or migrate logging services without rewriting all your code
- Host: GitHub
- URL: https://github.com/nwestfall/overlogger
- Owner: nwestfall
- License: other
- Created: 2018-12-31T16:09:32.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-31T20:02:56.000Z (over 7 years ago)
- Last Synced: 2025-12-02T23:47:13.854Z (7 months ago)
- Topics: android, appcenter, bugsnag, console, dotnet, ios, logging, logging-library, netstandard, xamarin
- Language: C#
- Size: 18.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Overlogger
[](https://dev.azure.com/nathanwestfall/Overlogger/_build/latest?definitionId=16?branchName=master)
[](https://www.codefactor.io/repository/github/nwestfall/overlogger)
Logging is something that every application needs, but it shouldn't be a burden to change analytic/crash providers. Write your app once with overlogger and then switch out providers on the fly.
## Why did I make this?
Being an Xamarin developer and going from Xamarin Insights, to HockeyApp, and then to App Center I got tired having to rewrite my logging logic each time I was forced to change. This library lets me write it once and then log to one or more than one provider at a time!
## Supported Platforms
- NETStandard 2.0
- iOS (10+)
- Android (4.4+)
## Available Nuget Packages
- Overlogger [](https://www.nuget.org/packages/Overlogger/)
- Overlogger.AppCenter [](https://www.nuget.org/packages/Overlogger.AppCenter/)
- Overlogger.BugSnag [](https://www.nuget.org/packages/Overlogger.BugSnag/)
- Overlogger.Console [](https://www.nuget.org/packages/Overlogger.Console/)
## How does it work
Simple. First, pick which provider you want to use. We currently support
- [App Center](https://appcenter.ms)
- [Bugsnag](https://www.bugsnag.com)
- Console
- More to come (create an issue!)
If you don't want to wait for me to create one, just implement `IReporter` on your own class.
#### Add a Reporter
```c#
var appCenterReporter = new AppCenterReporter("MY-KEY");
Logger.AddCrashReporter(appCenterReporter);
```
That's it. If you want to add another, just do the it twice!
```c#
var appCenterReporter = new AppCenterReporter("MY-KEY");
var bugSnagReporter = new BugSnagReporter("MY-KEY");
Logger.AddCrashReporter(appCenterReporter);
Logger.AddCrashReporter(bugSnagReporter);
```
#### Start Logging
Once a reporter is added, start logging away! Or if you start logging before a reporter is added, we'll keep track of that and then send the logs once a reporter is added.
```c#
Logger.Log(LogLevel.Info, "My Message");
Logger.Log(LogLevel.Info, "My Message", "MY-TAG");
Logger.Log(LogLevel.Error, "My Error", new Exception("My Exception"));
Logger.Log(LogLevel.Error, "My Error", new Exception("My Exception"), "MY-TAG");
```
You can even track events if the reporter supports it (most do)
```c#
Logger.TrackEvent("My Custom Event");
Logger.TrackEvent("My Custom Event", new Dictionary() { "My Property", "My Value" });
```
#### Change the minimum log level
If you don't want logs below a certain level to be reported, we'll take care of that for you too! Just pass the log level to either all reporters or just a specific one.
```c#
Logger.SetLogLevel(LogLevel.Warn); // For all reporters
Logger.SetLogLevelForReporter(LogLevel.Error); // Just the App Center Reporter
```
#### Remove a Reporter
If you want to remove a reporter, just pass the `Type`
```c#
Logger.RemoveCrashReporter();
```