Skip to content

Commit

Permalink
documentation with jazzy
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyTor committed Apr 30, 2020
1 parent 2b344d5 commit 6ecc83d
Show file tree
Hide file tree
Showing 44 changed files with 5,001 additions and 3 deletions.
4 changes: 4 additions & 0 deletions AdvancedLogger.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
D4251BC1243B1C2D002A41D4 /* ALLogWriteManagerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4251BC0243B1C2D002A41D4 /* ALLogWriteManagerProtocol.swift */; };
D4251BC3243B1DA0002A41D4 /* ALFilePopulateManagerErrors.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4251BC2243B1DA0002A41D4 /* ALFilePopulateManagerErrors.swift */; };
D4251BC5243B24DF002A41D4 /* AdvancedLoggerEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4251BC4243B24DF002A41D4 /* AdvancedLoggerEvent.swift */; };
D454BCF6245B004A0089B47B /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = D454BCF5245B004A0089B47B /* README.md */; };
D47AC554243C5AA90044B94C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D47AC553243C5AA90044B94C /* AppDelegate.swift */; };
D47AC558243C5AA90044B94C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D47AC557243C5AA90044B94C /* ViewController.swift */; };
D47AC55B243C5AA90044B94C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D47AC559243C5AA90044B94C /* Main.storyboard */; };
Expand Down Expand Up @@ -88,6 +89,7 @@
D4251BC0243B1C2D002A41D4 /* ALLogWriteManagerProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ALLogWriteManagerProtocol.swift; sourceTree = "<group>"; };
D4251BC2243B1DA0002A41D4 /* ALFilePopulateManagerErrors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ALFilePopulateManagerErrors.swift; sourceTree = "<group>"; };
D4251BC4243B24DF002A41D4 /* AdvancedLoggerEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedLoggerEvent.swift; sourceTree = "<group>"; };
D454BCF5245B004A0089B47B /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
D47AC551243C5AA90044B94C /* AdvancedLoggerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdvancedLoggerExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
D47AC553243C5AA90044B94C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
D47AC557243C5AA90044B94C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -211,6 +213,7 @@
D47AF141243A63AA0090DFAA = {
isa = PBXGroup;
children = (
D454BCF5245B004A0089B47B /* README.md */,
D4080994244E063200D27BD4 /* azure-pipelines.yml */,
D47AF14D243A63AA0090DFAA /* AdvancedLogger */,
D47AF158243A63AA0090DFAA /* AdvancedLoggerTests */,
Expand Down Expand Up @@ -446,6 +449,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D454BCF6245B004A0089B47B /* README.md in Resources */,
D4080995244E063200D27BD4 /* azure-pipelines.yml in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
2 changes: 1 addition & 1 deletion AdvancedLogger/Data Layer/Managers/AL/AdvancedLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Foundation
/// Main struct for interact with your app
public struct AdvancedLogger {

init() {
private init() {
self.writeManager = diresolver.getALLogWriteManager()
self.readManager = diresolver.getALLogReadManager()
self.queue = DispatchQueue(label: Constaints.Queue.queueAdvancedLogger.rawValue, qos: .utility)
Expand Down
13 changes: 12 additions & 1 deletion AdvancedLogger/Data Layer/Managers/AL/AdvancedLoggerEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@

import Foundation

/// Log type for write.
/// Log type for write. Containt different event like warning\crash\etc
public enum AdvancedLoggerEvent {

/// If you get warning use this event
case warning
/// if you get error (non fatal) use this case
case error
/// if your app crash use this
case crash
/// if you collect logs of any func and func successed use this one
case success
/// just event for logs any execution (in run state) logs from app
case execution
}

Expand All @@ -28,6 +33,9 @@ extension AdvancedLoggerEvent: Codable {
case unknownValue
}

/// !Dont use this! Public init for encode\decode.
/// - Parameter decoder: decoder
/// - Throws: error throw
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: Key.self)
let rawValue = try container.decode(Int.self, forKey: .rawValue)
Expand All @@ -47,6 +55,9 @@ extension AdvancedLoggerEvent: Codable {
}
}

/// !Dont use this! Encode to encoder
/// - Parameter encoder: encoder
/// - Throws: throw
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: Key.self)
switch self {
Expand Down
4 changes: 4 additions & 0 deletions AdvancedLogger/Data Layer/Models/AdvancedLoggerModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@

import Foundation

/// Main Model for log. Containt time stamp, log and type
public struct AdvancedLoggerModel: Codable {
/// Time stamp of logs. Format - "MM-dd-yyyy HH:mm:ss"
let time: String
/// Log in string,
let log: String
/// Type of this log (warning\crash\error etc)
let type: AdvancedLoggerEvent
}
65 changes: 64 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,65 @@
# AdvancedLogger
We create logger for our app
We create logger for our app. This framework in developing!
All operation execution in orher queue and you shouldnt think about manage queue

# Usage

## Standart use

1) Import in project

```swift
import AdvancedLogger
```

2) For write log use this with [model of log](Structs.html#/s:14AdvancedLogger0aB5ModelV) with [type of log](Enums/AdvancedLoggerEvent.html)

```swift
AdvancedLogger.shared.addNew(log: *MODEL OF LOG*, type: *TYPE OF LOG)
```

3) For read log in AdvancedLoggerModel use this

```swift
AdvancedLogger.shared.getLogs { (model) in }
```
where [model](Structs.html#/s:14AdvancedLogger0aB5ModelV) - array of logs

4) For read in JSON Encoding Data fromat use

```swift
AdvancedLogger.shared.getJSONDataLogs { (model) in }
```
where model - Data encoding JSON array of logs

5) For clean logs use

```swift
AdvancedLogger.shared.cleanLogs()
```

## Crypto

Our framework support crypto encode\decode
For use crypto in logs set crypto to enable

```swift
AdvancedLogger.shared.encryptData = true
```

For use custom keys use this:

```swift
AdvancedLogger.shared.aesCryptoKeys = ALAESCryptoInitModel(cryptoKey: *YOUR KEY*, initialVector: *YOUR VALUE*)
```

## Memory usage

All logs stored on FileManager of devices. And it use auto clean logs (on FIFO principle).

You can set custom size of logs in byte count format

```swift
AdvancedLogger.shared.logFileSize = 1024
```

113 changes: 113 additions & 0 deletions docs/Enums.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Enumerations Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>

</head>
<body>
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
<a title="Enumerations Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">AdvancedLogger 1.0.0 Docs</a> (97% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">AdvancedLogger Reference</a>
<img id="carat" src="img/carat.png" />
Enumerations Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/AdvancedLoggerEvent.html">AdvancedLoggerEvent</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/AdvancedLoggerProtocol.html">AdvancedLoggerProtocol</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ALAESCryptoInitModel.html">ALAESCryptoInitModel</a>
</li>
<li class="nav-group-task">
<a href="Structs/AdvancedLogger.html">AdvancedLogger</a>
</li>
<li class="nav-group-task">
<a href="Structs.html#/s:14AdvancedLogger0aB5ModelV">AdvancedLoggerModel</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Enumerations</h1>
<p>The following enumerations are available globally.</p>

</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:14AdvancedLogger0aB5EventO"></a>
<a name="//apple_ref/swift/Enum/AdvancedLoggerEvent" class="dashAnchor"></a>
<a class="token" href="#/s:14AdvancedLogger0aB5EventO">AdvancedLoggerEvent</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Log type for write. Containt different event like warning\crash\etc</p>

<a href="Enums/AdvancedLoggerEvent.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AdvancedLoggerEvent</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">AdvancedLoggerEvent</span><span class="p">:</span> <span class="kt">Codable</span></code></pre>

</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2020 <a class="link" href="https://github.com/ESKARIA/AdvancedLogger.git" target="_blank" rel="external">Dmitriy Toropkin</a>. All rights reserved. (Last updated: 2020-04-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
Loading

0 comments on commit 6ecc83d

Please sign in to comment.