Skip to content

Commit

Permalink
feat: implement log interface. (#657)
Browse files Browse the repository at this point in the history
* Refactor: reconstruct issue and label in GitHub.

* update feature-request label.

* update

* fix: update to correct workflow.

* fix: remove env.

* fix: remove unused release files.

* refactor: update workflows and remove unnecessary contents.

* Fix: remove uncorrect comment.

* remove labels.

* update yml

* update

* feat: implement log interface.

* update

* update

* update.
  • Loading branch information
mo3et committed Aug 14, 2024
1 parent a5ce7ec commit 4b70c00
Show file tree
Hide file tree
Showing 9 changed files with 438 additions and 105 deletions.
43 changes: 0 additions & 43 deletions .github/labels.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/auto-invite-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Invite users to join OpenIM Community.
on:
issue_comment:
types:
- created
jobs:
issue_comment:
name: Invite users to join OpenIM Community
if: ${{ github.event.comment.body == '/invite' || github.event.comment.body == '/close' || github.event.comment.body == '/comment' }}
runs-on: ubuntu-latest
permissions:
issues: write
steps:

- name: Invite user to join OpenIM Community
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
We value close connections with our users, developers, and contributors here at Open-IM-Server. With a large community and maintainer team, we're always here to help and support you. Whether you're looking to join our community or have any questions or suggestions, we welcome you to get in touch with us.
Our most recommended way to get in touch is through [Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q). Even if you're in China, Slack is usually not blocked by firewalls, making it an easy way to connect with us. Our Slack community is the ideal place to discuss and share ideas and suggestions with other users and developers of Open-IM-Server. You can ask technical questions, seek help, or share your experiences with other users of Open-IM-Server.
In addition to Slack, we also offer the following ways to get in touch:
+ <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" target="_blank"><img src="https://img.shields.io/badge/Slack-OpenIM%2B-blueviolet?logo=slack&amp;logoColor=white"></a> We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) team channel.
+ <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=info@openim.io" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a> Get in touch with us on [Gmail](https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email.
+ <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a> Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information.
+ <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a> Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible.
# - name: Close Issue
# uses: peter-evans/close-issue@v3
# with:
# token: ${{ secrets.BOT_GITHUB_TOKEN }}
# issue-number: ${{ github.event.issue.number }}
# comment: 🤖 Auto-closing issue, if you still need help please reopen the issue or ask for help in the community above
# labels: |
# accepted
53 changes: 0 additions & 53 deletions .github/workflows/auto-invite.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/check-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# uses: magnetikonline/action-golang-cache@v3
# with:
# go-version: ${{ env.GO_VERSION }}
# token: ${{ secrets.BOT_GITHUB_TOKEN }}
# token: ${{ secrets.BOT_TOKEN }}

# - name: Install Dependencies
# run: sudo apt update && sudo apt install -y libgpgme-dev libbtrfs-dev libdevmapper-dev
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ jobs:
env:
USERNAME: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/reopen-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
per_page: 100
});
const issueNumbers = issues
.filter(issue => !issue.pull_request) // 排除PR
.filter(issue => !issue.pull_request) // exclude PR
.map(issue => issue.number);
console.log(`Fetched issues: ${issueNumbers}`);
return issueNumbers;
Expand Down
30 changes: 24 additions & 6 deletions internal/third/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import (
"bufio"
"context"
"fmt"
"io"
"math/rand"
"os"
"path/filepath"
"strings"
"time"

"github.com/openimsdk/openim-sdk-core/v3/internal/file"
"github.com/openimsdk/openim-sdk-core/v3/internal/util"
"github.com/openimsdk/openim-sdk-core/v3/pkg/ccontext"
Expand All @@ -12,12 +19,6 @@ import (
"github.com/openimsdk/protocol/third"
"github.com/openimsdk/tools/errs"
"github.com/openimsdk/tools/log"
"io"
"math/rand"
"os"
"path/filepath"
"strings"
"time"
)

const (
Expand Down Expand Up @@ -187,3 +188,20 @@ func readLastNLines(filename string, n int) ([]string, error) {

return result, nil
}

func (c *Third) Log(ctx context.Context, logLevel int, path string, line string, err, msg string, keysAndValues []any) {
switch logLevel {
case 6:
// sdklog.SDKDebug(ctx, path, line, msg, keysAndValues)
log.ZDebug(ctx, msg, keysAndValues...)
case 4:
// sdklog.SDKInfo(ctx, path, line, msg, keysAndValues)
log.ZInfo(ctx, msg, keysAndValues...)
case 3:
// sdklog.SDKWarn(ctx, path, line, msg, errs.New(err), keysAndValues)
log.ZWarn(ctx, msg, errs.New(err), keysAndValues...)
case 2:
// sdklog.SDKError(ctx, path, line, msg, errs.New(err), keysAndValues)
log.ZError(ctx, msg, errs.New(err), keysAndValues...)
}
}
Loading

0 comments on commit 4b70c00

Please sign in to comment.