-
Notifications
You must be signed in to change notification settings - Fork 251
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(logging): Allow log to a file #954
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
01a9b36
feat(Logging api): add logging api
nicojs 187855e
feat(logging-api): first usage of logging api
nicojs a6feb8c
Merge branch 'master' into 748-logging-api
nicojs 8e50b4f
Update log4js 2.7
nicojs 09eb2f2
Merge branch 'master' into 748-logging-api
nicojs c50d69d
feat: add file log level option to stryker config
nicojs 98c2bfb
chore: add stryker.log to gitignore
nicojs c002d5c
docs(stryker): Document new file log level option
nicojs 7d2f3df
feat(file logging): add logging server
nicojs 6590624
refactor: remove unused import
nicojs 691e3a7
test(logging): Add unit test for multi appender
nicojs 042117e
refactor(stryker): Add semicolons
nicojs 188bada
test(logging): Add unit tests for the log configurator
nicojs d5d483e
Merge branch 'master' into 748-logging-api
nicojs 4fdc250
fix(karma-runner): remove logging logic from karma
nicojs 1729794
build(dev depedencies): remove unused types for old log4js
nicojs c14a520
chore(karma-runner): Add express.js types back
nicojs 0a30c08
test(stryker-api): fix failing test
nicojs 5a92cc3
test(logging): Remove accidental `.only`
nicojs be5477f
fix(logging): Remove color from file layout
nicojs 3339086
test(logging): Add logging integration test
nicojs 10bed57
refactor(ConfigReader): don't use `process.exit`
nicojs a820577
fix(taskkill): make killing of tasks more relient on windows
nicojs ee1efda
test(api): Improve error logging on integration test
nicojs 33aa4d9
test(karma-runner): Fix failing test in karma runner after merge
nicojs c2882b9
fix(logging): Make logging server more robust against race conditions
nicojs f59d0c2
test(stryker): Higher timeout for integration tests
nicojs 9d6a4f6
refactor: Remove code responsible for retrying different ports as it …
nicojs 82db388
Merge branch 'master' into 748-logging-api
nicojs 145e583
feat(jest-runner): Use new logging API
nicojs d10b523
build(karma-runner): Add express types back again
nicojs cbe94cc
refactor(logging): Implement review comments
nicojs 18859d6
Merge branch 'master' into 748-logging-api
nicojs 0761b79
fix(stryker-api): Update stryker-api peer dependency in preparation o…
nicojs 07cc2b1
refactor(isolated-runner): Remove `IsolatedRunnerOptions`
nicojs bafa8e8
Merge branch 'master' into 748-logging-api
nicojs 256f8ab
refactor: add semicolon
nicojs 6f64f1d
fix(log4js): update to log4js 3
nicojs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
node_modules | ||
lerna-debug.log | ||
npm-debug.log | ||
stryker.log | ||
|
||
coverage | ||
reports | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { default as LoggerFactory } from './src/logging/LoggerFactory'; | ||
export { default as Logger } from './src/logging/Logger'; | ||
export { default as LoggerFactoryMethod } from './src/logging/LoggerFactoryMethod'; | ||
export { default as getLogger } from './src/logging/getLogger'; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
enum LogLevel { | ||
Off = 'off', | ||
Fatal = 'fatal', | ||
Error = 'error', | ||
Warning = 'warn', | ||
Information = 'info', | ||
Debug = 'debug', | ||
Trace = 'trace' | ||
} | ||
|
||
export default LogLevel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default interface Logger { | ||
isTraceEnabled(): boolean; | ||
isDebugEnabled(): boolean; | ||
isInfoEnabled(): boolean; | ||
isWarnEnabled(): boolean; | ||
isErrorEnabled(): boolean; | ||
isFatalEnabled(): boolean; | ||
|
||
trace(message: string, ...args: any[]): void; | ||
debug(message: string, ...args: any[]): void; | ||
info(message: string, ...args: any[]): void; | ||
warn(message: string, ...args: any[]): void; | ||
error(message: string, ...args: any[]): void; | ||
fatal(message: string, ...args: any[]): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import LoggerFactoryMethod from './LoggerFactoryMethod'; | ||
import Logger from './Logger'; | ||
|
||
const noopLogger: Logger = { | ||
isTraceEnabled(): boolean { return false; }, | ||
isDebugEnabled(): boolean { return false; }, | ||
isInfoEnabled(): boolean { return false; }, | ||
isWarnEnabled(): boolean { return false; }, | ||
isErrorEnabled(): boolean { return false; }, | ||
isFatalEnabled(): boolean { return false; }, | ||
trace(): void { }, | ||
debug(): void { }, | ||
info(): void { }, | ||
warn(): void { }, | ||
error(): void { }, | ||
fatal(): void { } | ||
}; | ||
|
||
let logImplementation: LoggerFactoryMethod = () => noopLogger; | ||
|
||
export default class LoggerFactory { | ||
|
||
static setLogImplementation(implementation: LoggerFactoryMethod) { | ||
logImplementation = implementation; | ||
} | ||
|
||
static getLogger: LoggerFactoryMethod = (categoryName?: string) => { | ||
return logImplementation(categoryName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Logger from './Logger'; | ||
|
||
/** | ||
* Represents a factory to get loggers by category name. | ||
* This interface is used to describe the shape of a logger factory method. | ||
* | ||
* @param {String} [categoryName] name of category to log to. | ||
* @returns {Logger} instance of logger for the category | ||
*/ | ||
export default interface LoggerFactoryMethod { | ||
(categoryName?: string): Logger; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import LoggerFactory from './LoggerFactory'; | ||
import LoggerFactoryMethod from './LoggerFactoryMethod'; | ||
|
||
const getLogger: LoggerFactoryMethod = LoggerFactory.getLogger; | ||
|
||
export default getLogger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { expect } from 'chai'; | ||
import LogLevel from '../../../src/core/LogLevel'; | ||
|
||
describe('LogLevel', () => { | ||
|
||
function arrangeActAssertLogLevel(actual: LogLevel, expected: string) { | ||
it(`should provide "${expected}" for log level "${actual}"`, () => { | ||
expect(actual).eq(expected); | ||
}); | ||
} | ||
|
||
arrangeActAssertLogLevel(LogLevel.Off, 'off'); | ||
arrangeActAssertLogLevel(LogLevel.Fatal, 'fatal'); | ||
arrangeActAssertLogLevel(LogLevel.Error, 'error'); | ||
arrangeActAssertLogLevel(LogLevel.Warning, 'warn'); | ||
arrangeActAssertLogLevel(LogLevel.Information, 'info'); | ||
arrangeActAssertLogLevel(LogLevel.Debug, 'debug'); | ||
arrangeActAssertLogLevel(LogLevel.Trace, 'trace'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we really need getLogger in a separate file or can we also just place the content here?
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.
It is how our entire API is build up right now. Everything in separate files.
getLogger
is also used fromLoggerFactoryMethod
and others. You want me to move the entire logging API to this file?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.
Let's leave it like this for now.