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

Modifying test and benchmarks to match log level order #19

Merged
merged 3 commits into from May 6, 2019
Merged

Modifying test and benchmarks to match log level order #19

merged 3 commits into from May 6, 2019

Conversation

Kanshiroron
Copy link
Contributor

No description provided.

Log level order was incorrect: debug was before info.
This manifests in not having Info log not displayed when setting log level to debug.
Also changed benchmark for consistency
#18
@Kanshiroron Kanshiroron changed the title Moidying test and benchmarks to match log level order Modifying test and benchmarks to match log level order May 6, 2019
@apsdehal apsdehal merged commit f85330a into apsdehal:master May 6, 2019
@apsdehal
Copy link
Owner

apsdehal commented May 6, 2019

@Kanshiroron Still not passing, if you have time, try one more time otherwise I will push a fix tomorrow.

@Kanshiroron
Copy link
Contributor Author

@apsdehal Sorry I didn't have much time looking into it, but it's very weird to me trying to understand how my changes have broke the test...
The issue is following:

$ go test .
--- FAIL: TestLogger_SetFormat (0.00s)
    logger_test.go:157: 
        Want: #1 2019-05-06 10:23:09 logger_test.go:152 ▶ DEB Test
        Have: 
FAIL
FAIL	_/home/kanshi/temp/go-logger	0.001s

Which points to:

func TestLogger_SetFormat(t *testing.T) {
        var buf bytes.Buffer
        log, err := New("pkgname", 0, &buf)
        if err != nil || log == nil {
                panic(err)
        }
        log.Debug("Test")
        want := time.Now().Format("2006-01-02 15:04:05")
        want = fmt.Sprintf("#1 %s logger_test.go:152 ▶ DEB Test\n", want)
        have := buf.String()
        if have != want {
                t.Errorf("\nWant: %sHave: %s", want, have)
        }

If I comment the t.Errorf("\nWant: %sHave: %s", want, have) all other tests are working correctly.

@apsdehal
Copy link
Owner

Thanks. I have fixed the tests so the build should be passing now. I have tagged a new release for log level filters as well.

@Kanshiroron
Copy link
Contributor Author

awesome thanks! I indeed didn't have much time to investigate...

nexus166 pushed a commit to szampardi/msg that referenced this pull request Nov 6, 2019
c1a5a0b Add Maezen's name to major contributors' list
1abdf89 (tag: 1.3.0) Fix tests for Debug and add information about log levels
f85330a Modifying test and benchmarks to match log level order (apsdehal#19)
cdc27a2 Fixing log level order (apsdehal#18)
e1d9ff3 Time format fix (apsdehal#16)
c7c5677 Add log level filter (apsdehal#14)
c91ab3d Update bench command
cc384be Update README
7f202ac (tag: 1.2.0) Update README
7a6b3f6 Added tests. Fix errors (if invalid verbs)
91c4c36 Added methods Debugf(), Warningf(), etc, which are aliases to DebugF(), WarningF(), etc
6b33d28 Added opportunity to control format of log message
15baca6 (tag: 1.1.0) Merge pull request apsdehal#9 from gjvnq/master
41bcc36 Improved documentation
97287ef Added methods for an api more like printf by calling fmt.Sprintf internally
fa06e5f Added functions for printing the stack to the log.
887d7f7 Added line number and filename to the log
db2e3f4 (tag: 1.0.0) Changes README to shift godoc reference badge
78c2d85 Fixes tests for NewWorker method
9edad6b Adds support for user choice `io.Writer`
e945d77 Merge pull request #1 from adelq/patch-1
0daa3f4 Fix minor typo in `import` in example program
2971d08 Adds travis build status to readme
841086e Fixes travis build problems
38efe0f Travis dependencies
29bea6f Adds more benchmarks and tests for `NewWorker` function
e73bec8 Adds benchmarks and test for logger.New
d5920d1 Adds documentation link to README
ba59407 Changes the example image and updates README
6ebd393 Updates README and example png
f9bb19d Adds BSD License
e3fbe5f Updates comments in example and main file
f1649fa Adds a basic example for usage
5ca286a Fixes log.Info() by adding index in map
721511e Adds uint field to increment the log nos as message is logged
1ab7038 Fixes all the syntax errors and the format string
11cedf6 Adds comments for better explaination
82a828c Warning, Notice, Log and debug methods added
c8a7c38 Adds critical, fatal, panic methods
64f529e Removes `init.go`
45f69e0 Adds log function for logger class
b01fb89 Adds new logger function and info struct for logging infos
3793c86 Makes changes to shift init to main logger.go
dfc5058 Provides a basic initialize class that will initializes colors according to level
a9c1da0 Initial Commit
nexus166 added a commit to szampardi/msg that referenced this pull request Nov 6, 2019
c1a5a0b Add Maezen's name to major contributors' list
1abdf89 (tag: 1.3.0) Fix tests for Debug and add information about log levels
f85330a Modifying test and benchmarks to match log level order (apsdehal#19)
cdc27a2 Fixing log level order (apsdehal#18)
e1d9ff3 Time format fix (apsdehal#16)
c7c5677 Add log level filter (apsdehal#14)
c91ab3d Update bench command
cc384be Update README
7f202ac (tag: 1.2.0) Update README
7a6b3f6 Added tests. Fix errors (if invalid verbs)
91c4c36 Added methods Debugf(), Warningf(), etc, which are aliases to DebugF(), WarningF(), etc
6b33d28 Added opportunity to control format of log message
15baca6 (tag: 1.1.0) Merge pull request apsdehal#9 from gjvnq/master
41bcc36 Improved documentation
97287ef Added methods for an api more like printf by calling fmt.Sprintf internally
fa06e5f Added functions for printing the stack to the log.
887d7f7 Added line number and filename to the log
db2e3f4 (tag: 1.0.0) Changes README to shift godoc reference badge
78c2d85 Fixes tests for NewWorker method
9edad6b Adds support for user choice `io.Writer`
e945d77 Merge pull request #1 from adelq/patch-1
0daa3f4 Fix minor typo in `import` in example program
2971d08 Adds travis build status to readme
841086e Fixes travis build problems
38efe0f Travis dependencies
29bea6f Adds more benchmarks and tests for `NewWorker` function
e73bec8 Adds benchmarks and test for logger.New
d5920d1 Adds documentation link to README
ba59407 Changes the example image and updates README
6ebd393 Updates README and example png
f9bb19d Adds BSD License
e3fbe5f Updates comments in example and main file
f1649fa Adds a basic example for usage
5ca286a Fixes log.Info() by adding index in map
721511e Adds uint field to increment the log nos as message is logged
1ab7038 Fixes all the syntax errors and the format string
11cedf6 Adds comments for better explaination
82a828c Warning, Notice, Log and debug methods added
c8a7c38 Adds critical, fatal, panic methods
64f529e Removes `init.go`
45f69e0 Adds log function for logger class
b01fb89 Adds new logger function and info struct for logging infos
3793c86 Makes changes to shift init to main logger.go
dfc5058 Provides a basic initialize class that will initializes colors according to level
a9c1da0 Initial Commit
nexus166 added a commit to szampardi/msg that referenced this pull request Nov 6, 2019
b0d6ccf Add note about fmt complaint scheme to README
c1a5a0b Add Maezen's name to major contributors' list
1abdf89 (tag: 1.3.0) Fix tests for Debug and add information about log levels
f85330a Modifying test and benchmarks to match log level order (apsdehal#19)
cdc27a2 Fixing log level order (apsdehal#18)
e1d9ff3 Time format fix (apsdehal#16)
c7c5677 Add log level filter (apsdehal#14)
c91ab3d Update bench command
cc384be Update README
7f202ac (tag: 1.2.0) Update README
7a6b3f6 Added tests. Fix errors (if invalid verbs)
91c4c36 Added methods Debugf(), Warningf(), etc, which are aliases to DebugF(), WarningF(), etc
6b33d28 Added opportunity to control format of log message
15baca6 (tag: 1.1.0) Merge pull request apsdehal#9 from gjvnq/master
41bcc36 Improved documentation
97287ef Added methods for an api more like printf by calling fmt.Sprintf internally
fa06e5f Added functions for printing the stack to the log.
887d7f7 Added line number and filename to the log
db2e3f4 (tag: 1.0.0) Changes README to shift godoc reference badge
78c2d85 Fixes tests for NewWorker method
9edad6b Adds support for user choice `io.Writer`
e945d77 Merge pull request #1 from adelq/patch-1
0daa3f4 Fix minor typo in `import` in example program
2971d08 Adds travis build status to readme
841086e Fixes travis build problems
38efe0f Travis dependencies
29bea6f Adds more benchmarks and tests for `NewWorker` function
e73bec8 Adds benchmarks and test for logger.New
d5920d1 Adds documentation link to README
ba59407 Changes the example image and updates README
6ebd393 Updates README and example png
f9bb19d Adds BSD License
e3fbe5f Updates comments in example and main file
f1649fa Adds a basic example for usage
5ca286a Fixes log.Info() by adding index in map
721511e Adds uint field to increment the log nos as message is logged
1ab7038 Fixes all the syntax errors and the format string
11cedf6 Adds comments for better explaination
82a828c Warning, Notice, Log and debug methods added
c8a7c38 Adds critical, fatal, panic methods
64f529e Removes `init.go`
45f69e0 Adds log function for logger class
b01fb89 Adds new logger function and info struct for logging infos
3793c86 Makes changes to shift init to main logger.go
dfc5058 Provides a basic initialize class that will initializes colors according to level
a9c1da0 Initial Commit
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.

None yet

2 participants