Skip to content

Commit a043980

Browse files
committed
logProcessRun dev setting
1 parent 65c692b commit a043980

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

demo/app/samples/test.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export class TestComponent {
5353
debug: true,
5454
immediateLog: true,
5555
logTime: false,
56+
logProcessRun: true,
5657
throttle: 40,
5758
inertia: true,
5859
inertiaScrollDelay: 55,

src/component/classes/settings.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ export const minSettings: ISettings = {
2222
export const defaultDevSettings: IDevSettings = {
2323
debug: false, // if true, logging is enabled; need to turn off when release
2424
immediateLog: true, // if false, logging is not immediate and could be done via Workflow.logForce call
25-
logTime: false, // if true, time differences are being logged
25+
logTime: false, // if true, time differences will be logged
26+
logProcessRun: false, // if true, process fire/run info will be logged
2627
throttle: 40, // if > 0, scroll event handling is throttled (ms)
2728
inertia: true, // if true, inertia scroll delay (ms) and delta (px) are taken into the account
2829
inertiaScrollDelay: 125,
@@ -60,6 +61,7 @@ export class Settings implements ISettings {
6061
debug: boolean;
6162
immediateLog: boolean;
6263
logTime: boolean;
64+
logProcessRun: boolean;
6365
throttle: number;
6466
inertia: boolean;
6567
inertiaScrollDelay: number;

src/component/interfaces/settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface Settings {
1414
export interface DevSettings {
1515
debug?: boolean;
1616
immediateLog?: boolean;
17+
logProcessRun?: boolean;
1718
logTime?: boolean;
1819
throttle?: number;
1920
inertia?: boolean;

src/component/utils/assignSettings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export const assignDevSettings = (
9393
assignBoolean(target, devSettings, 'debug', defaults);
9494
assignBoolean(target, devSettings, 'immediateLog', defaults);
9595
assignBoolean(target, devSettings, 'logTime', defaults);
96+
assignBoolean(target, devSettings, 'logProcessRun', defaults);
9697
assignMinimalNumeric(target, devSettings, 'throttle', defaults, minDevSettings, true);
9798
assignBoolean(target, devSettings, 'inertia', defaults);
9899
assignMinimalNumeric(target, devSettings, 'inertiaScrollDelay', defaults, minDevSettings, true);

src/component/workflow.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@ export class Workflow {
7878
runProcess(data: ProcessSubject) {
7979
return (_process: any) =>
8080
(...args: any[]) => {
81-
// const { process, status, payload } = data;
82-
// this.logger.log(() =>
83-
// ['%cfire%c', ...['color: #cc7777;', 'color: #000000;'], process, `"${status}"`, ...(payload ? [payload] : [])]
84-
// );
85-
// this.logger.log(() => ['run', _process.name, ...args]);
81+
if (this.scroller.settings.logProcessRun) {
82+
const { process, status, payload } = data;
83+
this.scroller.logger.log(() => [
84+
'%cfire%c', ...['color: #cc7777;', 'color: #000000;'], process, `"${status}"`, ...(payload ? [payload] : [])
85+
]);
86+
this.scroller.logger.log(() => ['run', _process.name, ...args]);
87+
}
8688
_process.run(this.scroller, ...args);
8789
};
8890
}

0 commit comments

Comments
 (0)