-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Use common/logger everywhere, remove main/logger export #4317
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove (or split to another PR) all unrelated changes.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
cd7b429
to
58638cb
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
58638cb
to
e7ced08
Compare
@jakolehm I have undone the changes to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this PR also add no-console
eslint rule?
import { consoleFormat } from "winston-console-format"; | ||
import { isDebugging, isTestEnv } from "./vars"; | ||
import BrowserConsole from "winston-transport-browserconsole"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify why we are removing winston completely from renderer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, there are several reasons:
- Winston does not interact nicely with DevTools and the verbosity selector
- "winston-transport-browserconsole" has a bug where any "meta-data" after the second entry is ignored (which I believe is intentional)
src/common/logger.ts
Outdated
|
||
if (ipcMain) { | ||
transports.push( | ||
if (isTestEnv) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit odd because it relies on a global state... would it be better to have it as a function arg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a function argument to what? I could add a testing function that could be called to mock out the logger, is that what you mean?
0199042
to
632bf27
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
632bf27
to
2134f8f
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
f0cfb7f
to
875bc95
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
378a1ec
to
d69a3ce
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
- in Renderer make it 'console' which a stub for silly level - in Main make it a winston logger with file output as well - in testing make it a jest mock stub - in all other cases make it a winston logger without file output - Turn on no-console - Fix logger during integration testing Signed-off-by: Sebastian Malton <[email protected]>
bb339e8
to
9900006
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Closing this as we probably will want two logger injectables in the future. |
in Renderer make it 'console' which a stub for silly level
in Main make it a winston logger with file output as well
in testing make it a jest mock stub
in all other cases make it a winston logger without file output
Signed-off-by: Sebastian Malton [email protected]