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

feat: pkg/util/log Enhancement (sub task of pkg/util Enhancement #833) #858

Merged
merged 1 commit into from
Jul 19, 2022

Conversation

jxs1211
Copy link
Contributor

@jxs1211 jxs1211 commented Jul 17, 2022

Signed-off-by: xian-jie.shen 327411586@qq.com

Pre-Checklist

Note: please complete ALL items in the following checklist.

  • I have read through the CONTRIBUTING.md documentation.
  • My code has the necessary comments and documentation (if needed).
  • I have added relevant tests

Description

trying to resolve:

  • handle necessary err of file writing operation
  • add test case and hit a high coverage

Related Issues

see #833 for the details

New Behavior (screenshots if needed)

  • handle necessary err of file writing operation

image

  • ut coverage
[going@dev log]$ go test . -coverprofile=./coverage.out -timeout=10m -short -v
=== RUN   TestLog
2022-07-17 12:31:57 ℹ [INFO]  nice to meet you log
2022-07-17 12:31:57 ⚠ [WARN]  nice to meet you log
2022-07-17 12:31:57 ✔ [SUCCESS]  nice to meet you log
2022-07-17 12:31:57 !! [ERROR]  nice to meet you log
2022-07-17 12:31:57 ℹ [INFO]  -------------------- [  nice to meet you log  ] --------------------
2022-07-17 12:31:57 ℹ [INFO]  nice to meet you log
2022-07-17 12:31:57 ⚠ [WARN]  nice to meet you log
2022-07-17 12:31:57 ✔ [SUCCESS]  nice to meet you log
2022-07-17 12:31:57 !! [ERROR]  nice to meet you log
2022-07-17 12:31:57 ℹ [INFO]  -------------------- [  nice to meet you log  ] --------------------
--- PASS: TestLog (0.00s)
=== RUN   TestCliLoggerFormatter_Format
=== RUN   TestCliLoggerFormatter_Format/base
=== RUN   TestCliLoggerFormatter_Format/base_debug
--- PASS: TestCliLoggerFormatter_Format (0.00s)
    --- PASS: TestCliLoggerFormatter_Format/base (0.00s)
    --- PASS: TestCliLoggerFormatter_Format/base_debug (0.00s)
=== RUN   TestCliLoggerFormatter_levelPrintRender
=== RUN   TestCliLoggerFormatter_levelPrintRender/base
=== RUN   TestCliLoggerFormatter_levelPrintRender/base_debug
=== RUN   TestCliLoggerFormatter_levelPrintRender/base_info
=== RUN   TestCliLoggerFormatter_levelPrintRender/base_warn
=== RUN   TestCliLoggerFormatter_levelPrintRender/base_error
=== RUN   TestCliLoggerFormatter_levelPrintRender/base_fatal
=== RUN   TestCliLoggerFormatter_levelPrintRender/base_success
--- PASS: TestCliLoggerFormatter_levelPrintRender (0.00s)
    --- PASS: TestCliLoggerFormatter_levelPrintRender/base (0.00s)
    --- PASS: TestCliLoggerFormatter_levelPrintRender/base_debug (0.00s)
    --- PASS: TestCliLoggerFormatter_levelPrintRender/base_info (0.00s)
    --- PASS: TestCliLoggerFormatter_levelPrintRender/base_warn (0.00s)
    --- PASS: TestCliLoggerFormatter_levelPrintRender/base_error (0.00s)
    --- PASS: TestCliLoggerFormatter_levelPrintRender/base_fatal (0.00s)
    --- PASS: TestCliLoggerFormatter_levelPrintRender/base_success (0.00s)
=== RUN   TestSeparatorFormatter_Format
=== RUN   TestSeparatorFormatter_Format/base
=== RUN   TestSeparatorFormatter_Format/base_Entry_with_buffer
--- PASS: TestSeparatorFormatter_Format (0.00s)
    --- PASS: TestSeparatorFormatter_Format/base (0.00s)
    --- PASS: TestSeparatorFormatter_Format/base_Entry_with_buffer (0.00s)
=== RUN   Test_addCallStackIgnoreLogrus
=== RUN   Test_addCallStackIgnoreLogrus/base
--- PASS: Test_addCallStackIgnoreLogrus (0.00s)
    --- PASS: Test_addCallStackIgnoreLogrus/base (0.00s)
=== RUN   TestSymbols_String
=== RUN   TestSymbols_String/base
=== RUN   TestSymbols_String/base#01
=== RUN   TestSymbols_String/base#02
--- PASS: TestSymbols_String (0.00s)
    --- PASS: TestSymbols_String/base (0.00s)
    --- PASS: TestSymbols_String/base#01 (0.00s)
    --- PASS: TestSymbols_String/base#02 (0.00s)
PASS
coverage: 91.1% of statements
ok      github.com/devstream-io/devstream/pkg/util/log  0.007s  coverage: 91.1% of statements

@jxs1211 jxs1211 requested a review from a team as a code owner July 17, 2022 04:39
@IronCore864
Copy link
Member

Good tests!

@xavier-hou xavier-hou self-assigned this Jul 18, 2022
pkg/util/log/logwrapper_test.go Show resolved Hide resolved
@xavier-hou xavier-hou merged commit b0364a5 into devstream-io:main Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants