Skip to content

Commit

Permalink
Merge pull request #12 from epam/main
Browse files Browse the repository at this point in the history
Support timestamp/date/time in nanoseconds
  • Loading branch information
artsiomkorzun committed Aug 21, 2023
2 parents 1cf0384 + d66fb31 commit d42f179
Show file tree
Hide file tree
Showing 23 changed files with 457 additions and 58 deletions.
18 changes: 18 additions & 0 deletions .github/codeql/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "CodeQL Config"

queries:
- uses: security-and-quality

query-filters:
- exclude:
id: java/jdk-internal-api-access
- exclude:
id: java/missing-override-annotation
- exclude:
id: java/unused-parameter
- exclude:
id: java/confusing-method-signature
- exclude:
id: java/uncaught-number-format-exception
- exclude:
id: java/local-shadows-field
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,23 @@ jobs:
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Cache gradle dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- name: Cache gradle wrapper
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: Setup java
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Build with gradle
run: ./gradlew build
35 changes: 35 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "CodeQL"

on:
workflow_dispatch:
push:
branches: ['main', 'release-*']
pull_request:
types: [opened, synchronize]
branches: ['main', 'release-*']

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: java
queries: +security-and-quality
config-file: ./.github/codeql/config.yml
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:java"
16 changes: 9 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Prepare branch
run: |
git config user.name github-actions
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Checkout branch (Windows)
if: matrix.os == 'windows-latest'
run: |
Expand All @@ -58,8 +58,9 @@ jobs:
git fetch
git checkout -b workflow-$GITHUB_RUN_ID origin/workflow-$GITHUB_RUN_ID~1
- name: Setup java
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Build with gradle
run: ./gradlew build
Expand All @@ -71,7 +72,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Release branch
run: |
git config user.name github-actions
Expand All @@ -91,16 +92,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Checkout branch
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git fetch
git checkout -b workflow-$GITHUB_RUN_ID origin/workflow-$GITHUB_RUN_ID~1
- name: Setup java
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 8
- name: Publish jars
run: ./gradlew publishAll
Expand All @@ -118,7 +120,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Cleanup
run: |
git config user.name github-actions
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
![Maven Central](https://img.shields.io/maven-central/v/com.epam.deltix/gflog-api)

![Continuous Integration](https://github.com/epam/GFLog/workflows/Continuous%20Integration/badge.svg?branch=main)
[![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/epam/GFLog.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/epam/GFLog/context:java)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/epam/GFLog.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/epam/GFLog/alerts/)
![CodeQL](https://github.com/epam/GFLog/workflows/CodeQL/badge.svg?branch=main)

Highly efficient garbage-free logging framework for Java 8+.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ public interface AppendableEntry extends Appendable {
*/
AppendableEntry appendTimestamp(final long timestamp);

/**
* Appends the timestamp in nanoseconds since Epoch in "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'" format to this entry.
*
* @param timestampNs in nanoseconds since Epoch to append.
* @return a reference to this object.
*/
AppendableEntry appendTimestampNs(final long timestampNs);

/**
* Appends the date part of the timestamp in milliseconds since Epoch in "yyyy-MM-dd" format to this entry.
*
Expand All @@ -136,6 +144,14 @@ public interface AppendableEntry extends Appendable {
*/
AppendableEntry appendDate(final long timestamp);

/**
* Appends the date part of the timestamp in nanoseconds since Epoch in "yyyy-MM-dd" format to this entry.
*
* @param timestampNs in nanoseconds since Epoch to append.
* @return a reference to this object.
*/
AppendableEntry appendDateNs(final long timestampNs);

/**
* Appends the time part of the timestamp in milliseconds since Epoch in "HH:mm:ss.SSS" format to this entry.
*
Expand All @@ -144,6 +160,14 @@ public interface AppendableEntry extends Appendable {
*/
AppendableEntry appendTime(final long timestamp);

/**
* Appends the time part of the timestamp in nanoseconds since Epoch in "HH:mm:ss.SSSSSSSSS" format to this entry.
*
* @param timestampNs in nanoseconds since Epoch to append.
* @return a reference to this object.
*/
AppendableEntry appendTimeNs(final long timestampNs);

/**
* Appends the alphanumeric value to this entry.
*
Expand Down
55 changes: 52 additions & 3 deletions gflog-api/src/main/java/com/epam/deltix/gflog/api/LogEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ public interface LogEntry extends AppendableEntry {
@CheckReturnValue
LogEntry appendTimestamp(final long timestamp);

/**
* Appends the timestamp in nanoseconds since Epoch in "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'" format to this entry.
*
* @param timestampNs in nanoseconds since Epoch to append.
* @return a reference to this object.
*/
@CheckReturnValue
LogEntry appendTimestampNs(final long timestampNs);

/**
* Appends the date part of the timestamp in milliseconds since Epoch in "yyyy-MM-dd" format to this entry.
*
Expand All @@ -154,6 +163,15 @@ public interface LogEntry extends AppendableEntry {
@CheckReturnValue
LogEntry appendDate(final long timestamp);

/**
* Appends the date part of the timestamp in nanoseconds since Epoch in "yyyy-MM-dd" format to this entry.
*
* @param timestampNs in nanoseconds since Epoch to append.
* @return a reference to this object.
*/
@CheckReturnValue
LogEntry appendDateNs(final long timestampNs);

/**
* Appends the time part of the timestamp in milliseconds since Epoch in "HH:mm:ss.SSS" format to this entry.
*
Expand All @@ -163,6 +181,15 @@ public interface LogEntry extends AppendableEntry {
@CheckReturnValue
LogEntry appendTime(final long timestamp);

/**
* Appends the time part of the timestamp in nanoseconds since Epoch in "HH:mm:ss.SSSSSSSSS" format to this entry.
*
* @param timestampNs in nanoseconds since Epoch to append.
* @return a reference to this object.
*/
@CheckReturnValue
LogEntry appendTimeNs(final long timestampNs);

/**
* Appends the alphanumeric value to this entry.
*
Expand Down Expand Up @@ -299,14 +326,29 @@ public interface LogEntry extends AppendableEntry {
void appendTimestampLast(final long timestamp);

/**
* Appends the date part of the timestamp in milliseconds since Epoch in "yyyy-MM-dd" format to this entry.
* Commits this entry.
* Appends the timestamp in nanoseconds since Epoch in "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'" format to this entry.
* Commits this entry.
*
* @param timestampNs in nanoseconds since Epoch to append.
*/
void appendTimestampNsLast(final long timestampNs);

/**
* Appends the date part of the timestamp in milliseconds since Epoch in "yyyy-MM-dd" format to this entry.
* Commits this entry.
*
* @param timestamp in milliseconds since Epoch to append.
*/
void appendDateLast(final long timestamp);

/**
* Appends the date part of the timestamp in nanoseconds since Epoch in "yyyy-MM-dd" format to this entry.
* Commits this entry.
*
* @param timestampNs in nanoseconds since Epoch to append.
*/
void appendDateNsLast(final long timestampNs);

/**
* Appends the time part of the timestamp in milliseconds since Epoch in "HH:mm:ss.SSS" format to this entry.
* Commits this entry.
Expand All @@ -315,6 +357,14 @@ public interface LogEntry extends AppendableEntry {
*/
void appendTimeLast(final long timestamp);

/**
* Appends the time part of the timestamp in nanoseconds since Epoch in "HH:mm:ss.SSSSSSSSS" format to this entry.
* Commits this entry.
*
* @param timestampNs in nanoseconds since Epoch to append.
*/
void appendTimeNsLast(final long timestampNs);

/**
* Appends the alphanumeric value to this entry.
* Commits this entry.
Expand All @@ -323,7 +373,6 @@ public interface LogEntry extends AppendableEntry {
*/
void appendAlphanumericLast(final long alphanumeric);


/**
* Aborts this entry. Clears its content after.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ public interface LogEntryTemplate {
*/
LogEntryTemplate withTimestamp(final long timestamp);

/**
* Inserts the timestamp in nanoseconds since Epoch in "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'" format to this template.
*
* @param timestampNs in nanoseconds since Epoch to insert.
* @return a reference to this object.
*/
LogEntryTemplate withTimestampNs(final long timestampNs);

/**
* Inserts the date part of the timestamp in milliseconds since Epoch in "yyyy-MM-dd" format to this template.
*
Expand All @@ -136,6 +144,14 @@ public interface LogEntryTemplate {
*/
LogEntryTemplate withDate(final long timestamp);

/**
* Inserts the date part of the timestamp in nanoseconds since Epoch in "yyyy-MM-dd" format to this template.
*
* @param timestampNs in nanoseconds since Epoch to insert.
* @return a reference to this object.
*/
LogEntryTemplate withDateNs(final long timestampNs);

/**
* Inserts the time part of the timestamp in milliseconds since Epoch in "HH:mm:ss.SSS" format to this template.
*
Expand All @@ -144,6 +160,14 @@ public interface LogEntryTemplate {
*/
LogEntryTemplate withTime(final long timestamp);

/**
* Inserts the time part of the timestamp in nanoseconds since Epoch in "HH:mm:ss.SSSSSSSSS" format to this template.
*
* @param timestampNs in nanoseconds since Epoch to insert.
* @return a reference to this object.
*/
LogEntryTemplate withTimeNs(final long timestampNs);

/**
* Inserts the alphanumeric value to this template.
*
Expand Down
Loading

0 comments on commit d42f179

Please sign in to comment.