Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log parser UI Application #112

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,7 @@ jobs:
if: ${{ runner.os == 'macOS' }}
run: cargo build -Z build-std -p ezlog --release --lib --target aarch64-apple-ios
- name: Clippy Check
run: cargo clippy --all --all-features -- -D warnings
# tauri cant run from cargo
run: |
cargo clippy -p ezlog --all-features -- -D warnings
cargo clippy -p ezlogcli --all-features -- -D warnings
123 changes: 123 additions & 0 deletions .github/workflows/publish_tauri.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: "publish_tauri"

on: workflow_dispatch


# `tauri-action` can also upload app bundles to an existing GitHub release.
# This workflow uses different actions to create and publish the release.
# `tauri-action` will only build and upload the app bundles to the specified release.

jobs:
create-release:
permissions:
contents: write
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ./ui-tauri
outputs:
release_id: ${{ steps.create-release.outputs.result }}

steps:
- uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: get version
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV

- name: create release
id: create-release
uses: actions/github-script@v6
with:
script: |
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `ezlog-ui-${process.env.PACKAGE_VERSION}`,
name: `ezlog-ui v${process.env.PACKAGE_VERSION}`,
body: 'Take a look at the assets to download and install this app.',
draft: true,
prerelease: false
})
return data.id

build-tauri:
needs: create-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
- platform: "macos-13" # for Intel based macs.
args: "--target x86_64-apple-darwin"
- platform: "ubuntu-20.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: ""
- platform: "windows-latest"
args: ""

runs-on: ${{ matrix.platform }}
defaults:
run:
working-directory: ./ui-tauri
steps:
- uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
override: true
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.

- name: install frontend dependencies
run: npm install # change this to npm, pnpm or bun depending on which one you use.

- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
args: ${{ matrix.args }}

publish-release:
permissions:
contents: write
runs-on: ubuntu-latest
needs: [create-release, build-tauri]

steps:
- name: publish release
id: publish-release
uses: actions/github-script@v6
env:
release_id: ${{ needs.create-release.outputs.release_id }}
with:
script: |
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.release_id,
draft: true,
prerelease: false
})
52 changes: 28 additions & 24 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,64 +7,68 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Add
- **NEW** add desktop ui application, build by tauri https://github.com/s1rius/ezlog/pull/112
- support [dingy](https://github.com/sonos/dinghy) test workflow https://github.com/s1rius/ezlog/pull/114
- add JSON serialization and deserialization functionality https://github.com/s1rius/ezlog/pull/108


## [0.2.0] (2023-10-14)

### Add
- cli: Add key, nonce to cli options https://github.com/s1rius/ezlog/pull/29
- Add create time info to file header https://github.com/s1rius/ezlog/pull/38
- Make file rorate duration configurable https://github.com/s1rius/ezlog/pull/46
- Add log file header extra info https://github.com/s1rius/ezlog/pull/48
- Add AES-GCM-SIV encryption as mandatory for v2 https://github.com/s1rius/ezlog/pull/56
- Generate a unique nonce for each encryption instance https://github.com/s1rius/ezlog/pull/56
- Make log record format configurable https://github.com/s1rius/ezlog/pull/66
- Add integration test https://github.com/s1rius/ezlog/pull/67
- Rotate file when the query date is today https://github.com/s1rius/ezlog/pull/70
- add create time info to file header https://github.com/s1rius/ezlog/pull/38
- make file rorate duration configurable https://github.com/s1rius/ezlog/pull/46
- add log file header extra info https://github.com/s1rius/ezlog/pull/48
- add AES-GCM-SIV encryption as mandatory for v2 https://github.com/s1rius/ezlog/pull/56
- generate a unique nonce for each encryption instance https://github.com/s1rius/ezlog/pull/56
- make log record format configurable https://github.com/s1rius/ezlog/pull/66
- add integration test https://github.com/s1rius/ezlog/pull/67
- rotate file when the query date is today https://github.com/s1rius/ezlog/pull/70
- android: Add x86 and x86_64 ABI support https://github.com/s1rius/ezlog/pull/71
- android: make `android_logger` dependency optional https://github.com/s1rius/ezlog/pull/75
- Add `nest-log` example https://github.com/s1rius/ezlog/pull/76
- add `nest-log` example https://github.com/s1rius/ezlog/pull/76

### Change
- **Break** change the `request_log_files_for_date` function paramter to a time range https://github.com/s1rius/ezlog/pull/90
- **Break** android:rename native function name, remove underline https://github.com/s1rius/ezlog/pull/26
- remove global panic hook https://github.com/s1rius/ezlog/pull/91
- Use varint to describe log's content length https://github.com/s1rius/ezlog/pull/32
- Compress first then encrypt https://github.com/s1rius/ezlog/pull/40
- use varint to describe log's content length https://github.com/s1rius/ezlog/pull/32
- compress first then encrypt https://github.com/s1rius/ezlog/pull/40

### Fix
- Auto rotate log file, when the config is not match previous https://github.com/s1rius/ezlog/pull/60
- auto rotate log file, when the config is not match previous https://github.com/s1rius/ezlog/pull/60

## [0.1.7] (2022-11-24)

### Fix
- Fix appender rolling fail https://github.com/s1rius/ezlog/pull/22
- Fix get error on request logs path multi times https://github.com/s1rius/ezlog/pull/23
- Fix global typo by @nickming https://github.com/s1rius/ezlog/pull/21
- fix appender rolling fail https://github.com/s1rius/ezlog/pull/22
- fix get error on request logs path multi times https://github.com/s1rius/ezlog/pull/23
- fix global typo by @nickming https://github.com/s1rius/ezlog/pull/21

### Add
- Add ci build android and ios rust lib https://github.com/s1rius/ezlog/pull/17
- add ci build android and ios rust lib https://github.com/s1rius/ezlog/pull/17
- flutter: support trim function https://github.com/s1rius/ezlog/pull/18
- Add mobile benchmark https://github.com/s1rius/ezlog/pull/20
- add mobile benchmark https://github.com/s1rius/ezlog/pull/20

## [0.1.6] (2022-11-1)
- Support trim log files which are out of date
- support trim log files which are out of date

## [0.1.5] (2022-08-25)

- Fix android jni method signature error
- Support multi callbacks
- fix android jni method signature error
- support multi callbacks

## [0.1.4] (2022-07-25)

- Update android/iOS prebuild library
- update android/iOS prebuild library

## [0.1.3] (2022-07-25)

- FFI hook panic when init
- Downgrade ios support version to 13.0
- Use Result when index is out of bounds
- Add features: decode, backtrace, log
- downgrade ios support version to 13.0
- use Result when index is out of bounds
- add features: decode, backtrace, log

[Unreleased]: https://github.com/s1rius/ezlog/compare/0.2.0...HEAD
[0.2.0]: https://github.com/s1rius/ezlog/compare/0.1.7...0.2.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

[workspace]
members = ["ezlogcli", "ezlog-core", "examples/android_preview", "examples/nest_log", "examples/hello_world", "test-compat"]
members = ["ezlogcli", "ezlog-core", "examples/android_preview", "examples/nest_log", "examples/hello_world", "test-compat", "ui-tauri/src-tauri"]
resolver = "2"

# https://github.com/johnthagen/min-sized-rust
Expand Down
4 changes: 3 additions & 1 deletion docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

# Quick Start

- [Rust](./platform/rust.md)
- [Flutter](./platform/flutter.md)
- [Android](./platform/android.md)
- [iOS](./platform/ios.md)
- [Rust](./platform/rust.md)

[Log query](./query.md)

[Benchmark](./benchmark.md)

Expand Down
Binary file added docs/src/images/ui-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/src/platform/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ override fun onCreate() {
Log.i("ezlog", "$logName $date $err")
}
})

// get logs
EZLog.requestLogFilesForDate("demo", new Date())
}

```
2 changes: 1 addition & 1 deletion docs/src/platform/flutter.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class _MyAppState extends State<MyApp> {

logger.d("init", "success");

var logs = await EZLog.requestLogFilesForDate("main", "2022_08_25");
var logs = await EZLog.requestLogFilesForDate("main", DateTime.now());
}
}
```
3 changes: 3 additions & 0 deletions docs/src/platform/ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ init() {
})

logger.debug("first blood")

let millis = Int64((date.timeIntervalSince1970 * 1000.0).rounded())
requestLogsForDate(logName: "demo", start: millis, end: millis)
}
```
click run and see console ouput.
22 changes: 21 additions & 1 deletion docs/src/platform/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,21 @@ use ezlog::Level;
use log::{error, info, warn};
use log::{LevelFilter, Log};

ezlog::InitBuilder::new().init();
let on_success: fn(&str, &str, &[&str]) = |name, date, logs| {
println!(
"on_success: name: {}, desc: {}, tags: {:?}", name, date, logs
);
};

let on_fail: fn(&str, &str, &str) = |name, date, err| {
println!(
"on_fail: name: {}, desc: {}, err: {}", name, date, err
);
};

ezlog::InitBuilder::new()
.with_request_callback_fn(on_success, on_fail)
.init();

let config = EZLogConfigBuilder::new()
.level(Level::Trace)
Expand All @@ -33,6 +47,12 @@ ezlog::create_log(config);

info!("hello ezlog");

ezlog::request_log_files_for_date(
ezlog::DEFAULT_LOG_NAME,
OffsetDateTime::now_utc(),
OffsetDateTime::now_utc()
);

```

see more examples in examples dir.
11 changes: 11 additions & 0 deletions docs/src/query.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Logs Query&View

### View Logs

If you want view a log file, you can use cmdline tools to parse the log, and open the output file in any text viewer application. Or you can download ezlog-ui application which is a desktop app built by tauri, it support decompress and decrypt.

download at [release page]( https://github.com/s1rius/ezlog/releases/tag/ezlog-ui-0.1.0)

Open the app, and drag the log file to the window, you can see the log conent.

![screenshot](images/ui-screenshot.png)
2 changes: 1 addition & 1 deletion ezlog-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ keywords = ["ezlog"]
crate-type = ["lib", "cdylib", "staticlib"]

[features]
default = ["json"]
default = []
log = ["dep:log"]
json = ["serde", "serde_json", "bitflags/serde"]
decode = ["aes-gcm", "regex", "log", "hex"]
Expand Down
Loading
Loading