Skip to content

Commit c6e57ed

Browse files
authored
Updated Readme (#37)
* Added developer section * Added steps on how to add new release that jitpack can pickup * Added TOC
1 parent 47c4c52 commit c6e57ed

File tree

1 file changed

+81
-25
lines changed

1 file changed

+81
-25
lines changed

README.md

Lines changed: 81 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,81 @@
11
# SteamcLog Android
2+
23
[Current Proposal Spec](https://docs.google.com/document/d/1GeFAMBn_ZrIP7qVLzcYlCfqDnPiCrgMa0JdrU8HRx94/edit?usp=sharing)
4+
35
[iOS Version](https://github.com/steamclock/steamclog)
46

57
An open source library that consolidates/formalizes the logging setup and usage across all of Steamclock's projects.
68

7-
## Installation
9+
## Table of Contents
10+
* [Development](#development)
11+
+ [Deploying new versions](#deploying-new-versions)
12+
* [Usage](#usage)
13+
+ [Installation](#installation)
14+
+ [Initialization](#initialization)
15+
- [Enabling External File Logging](#enabling-external-file-logging)
16+
+ [Enabling Sentry Reporting](#enabling-sentry-reporting)
17+
- [Enabling Firebase Crashlytics](#enabling-firebase-crashlytics)
18+
- [Enabling Firebase Analytics](#enabling-firebase-analytics)
19+
+ [Configuration](#configuration)
20+
- [logLevel: LogLevelPreset](#loglevel--loglevelpreset)
21+
- [requireRedacted: Bool](#requireredacted--bool)
22+
+ [Common methods](#common-methods)
23+
- [Basic Signatures](#basic-signatures)
24+
- [Error and Fatal Specific Signatures](#error-and-fatal-specific-signatures)
25+
+ [Exporting Logs](#exporting-logs)
26+
- [Variable Redaction](#variable-redaction)
27+
28+
_[Table of contents generated with markdown-toc](http://ecotrust-canada.github.io/markdown-toc/)_
29+
30+
## Development
31+
32+
### Deploying new versions
33+
34+
These steps are for developers looking to create a new release of the Steamclog library; if this does not pertain to you, please skip down to the **Installation** section.
35+
36+
Currently we are hosting the library on [Jitpack](https://jitpack.io/), to deploy a new version of the library:
37+
38+
1. Push all changes to master
39+
2. From within the GitHub repo, navigate to the Code panel; on the right side should be a **Releases** section
40+
3. Click on **Releases** (which should take you [here](https://github.com/steamclock/steamclog-android/releases))
41+
4. Make note of the latest release version name (ie. v1.1)
42+
5. Click the **Draft a new release** button on the right
43+
6. Set the **Tag Version**; it's best use the last release version as a guide (ie. set as v1.2)
44+
7. Set **Release Title** to be "Steamclog <Version>"
45+
8. Description is optional, could set changelog here if desired
46+
9. Click the **Publish Release** button at the bottom
47+
10. Verify on the [Jitpack page for the Steamclog project](https://jitpack.io/#steamclock/steamclog-android) that the new version is available
48+
11. Update projects using Steamclog with the new version
49+
50+
## Usage
851

9-
Current supported MinSDK: 21
10-
The library is not yet hosted publicly, so current installation steps involve building and copying over the AAR file from this repo.
52+
### Installation
1153

12-
Steps to install Steamclog:
13-
1. Create an `aars` folder in your project's app module (if it does not already exist)
14-
2. Place the `steamclog-release.aar` file into the `aars` folder.
15-
3. Add the following to your app module's build.gradle file:
16-
```
17-
implementation files('aars/steamclog-debug.aar')
18-
```
19-
4. Sync your project grdle files
20-
5. `Steamclog`singleton should now be available
54+
Steamclog is currently hosted on Jitpack; to include it in your project:
2155

22-
## Initialization
56+
1. Add this in your **root** build.gradle at the end of repositories:
57+
```
58+
allprojects {
59+
repositories {
60+
...
61+
maven { url 'https://jitpack.io' }
62+
}
63+
}
64+
```
65+
66+
2. Add the dependency in your app module's build.gradle:
67+
```
68+
dependencies {
69+
implementation 'com.github.steamclock:steamclog-android:<VERSION>'
70+
}
71+
```
72+
Most recent version can be found [here](https://github.com/steamclock/steamclog-android/releases)
73+
74+
3. Sync your project gradle files
75+
76+
4. `Steamclog` singleton should now be available
77+
78+
### Initialization
2379

2480
Steamclog can also be accessed via the `clog` typealias.
2581

@@ -30,7 +86,7 @@ Out of the box, Steamclog will have support for
3086
* Firebase Crashlytics (setup required)
3187
* Firebase Analytics (setup required)
3288

33-
### Enabling External File Logging
89+
#### Enabling External File Logging
3490

3591
The `Steamclog.initWith` method can be used to enable external logging; this method only needs to be called once, and can be done in your Application object's `onCreate` method.
3692

@@ -49,14 +105,14 @@ You will need to create a new application on the Sentry dashboard which requires
49105

50106
Once your main project has Sentry enabled no further work should be required for Steamclog to report to it.
51107

52-
### Enabling Firebase Crashlytics
108+
#### Enabling Firebase Crashlytics
53109

54110
To setup Firebase Crashyltics in your project, see https://firebase.google.com/docs/crashlytics/get-started?platform=android
55111

56112
Once your main project has Crashlytics enabled (ie. includes the required `google-services.json` file etc...) no further work should be required for Steamclog to report to it.
57113

58114

59-
### Enabling Firebase Analytics
115+
#### Enabling Firebase Analytics
60116

61117
To setup Firebase Analytics in your project, see https://firebase.google.com/docs/analytics/get-started?platform=android
62118

@@ -73,11 +129,11 @@ Both logging and analytics can be initialized at the same time:
73129
clog.initWith(fileWritePath = externalCacheDir, firebaseAnalytics = Firebase.analytics)
74130
```
75131

76-
## Configuration
132+
### Configuration
77133

78134
SteamcLog has a number of configuration options
79135

80-
### logLevel: LogLevelPreset
136+
#### logLevel: LogLevelPreset
81137
Default value is: `develop`.
82138
There are four log level presets available, each of which has different logging outputs.
83139

@@ -86,16 +142,16 @@ There are four log level presets available, each of which has different logging
86142
| `firehose` | verbose | verbose | none |
87143
| `develop` | none | debug | none |
88144
| `release` | none | none | warn |
89-
| `releaseAdvanced` | verbose | none | warn |
145+
| `releaseAdvanced` | verbose | none | info |
90146

91147
In most cases, you'll be able to get by using `firehose` or `develop` on debug builds, and `release` or `releaseAdvanced` for production builds.
92148
Note that if you're using `releaseAdvanced` you must build in a way for the client to email you the disk logs.
93149

94-
### requireRedacted: Bool
150+
#### requireRedacted: Bool
95151
Default value is `false`.
96152
Require that all logged objects conform to Redacted or are all redacted by default.
97153

98-
## Usage
154+
### Common methods
99155

100156
From there, you can use `clog` anywhere in your application with the following levels. Note that availability of these logs will depend on your Configuration's `logLevel`.
101157

@@ -106,26 +162,26 @@ From there, you can use `clog` anywhere in your application with the following l
106162
`clog.error` - Something has gone wrong, report to a remote service (like Crashlytics)
107163
`clog.fatal` - Something has gone wrong and we cannot recover, so force the app to close.
108164

109-
### Basic Signatures
165+
#### Basic Signatures
110166

111167
Each of these functions has the following 2 available signatures:
112168
`clog.<level>(_ message: String)`
113169
`clog.<level>(_ message: String, object: Any)`
114170

115171
If `requireRedacted` is set to `true`, then the Any object *must* implement the Redactable interface, else all properties will be shown as `<REDACTED>`.
116172

117-
### Error and Fatal Specific Signatures
173+
#### Error and Fatal Specific Signatures
118174
Error and Fatal levels have 2 more signatures that allows a given Throwable to be associated with the log.
119175
`clog.<level>(_ message: String, throwable: Throwable)`
120176
`clog.<level>(_ message: String, throwable: Throwable, object: Any)`
121177

122178
If no `Throwable` object is given for an error or fatal log, Steamclog will create a generic `NonFatalException` instance that will be used to generate crash reports on Crashlytics.
123179

124-
## Exporting Logs
180+
### Exporting Logs
125181

126182
If logging to a file has been enabled, then files, you can get the log file contents using `clog.getLogFileContents(): String?`
127183

128-
### Variable Redaction
184+
#### Variable Redaction
129185

130186
`Redacted` is a protocol that can be conformed to by a struct or class for marking particular fields as safe for logging. By default, a class implementing the `Redactable` will have all fields marked as redacted, and you can define logging-safe fields using the `safeProperties` field.
131187

0 commit comments

Comments
 (0)