Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Remove the CKEditor 5 logger and its usage #295

Merged
merged 5 commits into from
Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/dom/rect.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
* @module utils/dom/rect
*/

/* globals console */

import isRange from './isrange';
import isWindow from './iswindow';
import getBorderWidths from './getborderwidths';
import log from '../log';
import isText from './istext';
import { isElement } from 'lodash-es';
import { attachLinkToDocumentation } from '../ckeditorerror';

const rectProperties = [ 'top', 'right', 'bottom', 'left', 'width', 'height' ];

Expand Down Expand Up @@ -82,10 +84,9 @@ export default class Rect {
* @error rect-source-not-in-dom
* @param {String} source The source of the Rect instance.
*/
log.warn(
console.warn( attachLinkToDocumentation(
'rect-source-not-in-dom: The source of this rect does not belong to any rendered DOM tree.',
{ source }
);
), { source } );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be displayed only in the debug mode, this error tells nothing to end users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the error code/message could be better? Because I think that the warning should be displayed at least.

}

if ( isSourceRange ) {
Expand Down
76 changes: 0 additions & 76 deletions src/log.js

This file was deleted.

8 changes: 5 additions & 3 deletions src/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
* @module utils/version
*/

/* globals window, global */
/* globals window, global, console */

import log from './log';
import { version } from 'ckeditor5/package.json';
import { attachLinkToDocumentation } from './ckeditorerror';

const windowOrGlobal = typeof window === 'object' ? window : global;

Expand Down Expand Up @@ -138,7 +138,9 @@ if ( windowOrGlobal.CKEDITOR_VERSION ) {
*
* @error ckeditor-duplicated-modules
*/
log.error( 'ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated.' );
console.error( attachLinkToDocumentation(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be CKEditorError expectation.

'ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated.'
) );
} else {
windowOrGlobal.CKEDITOR_VERSION = version;
}
2 changes: 1 addition & 1 deletion tests/_utils-tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe( 'utils - testUtils', () => {
} );

it( 'should create an observer', () => {
function Emitter() { }
function Emitter() {}
Emitter.prototype = EmitterMixin;

expect( observer ).to.be.instanceof( Emitter );
Expand Down
8 changes: 4 additions & 4 deletions tests/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ describe( 'Collection', () => {
sinon.assert.calledWithExactly( spy, callback, ctx );
expect( ret ).to.deep.equal( [ 'foo' ], 'ret value was forwarded' );

function callback() { }
function callback() {}
} );
} );

Expand All @@ -538,7 +538,7 @@ describe( 'Collection', () => {
sinon.assert.calledWithExactly( spy, callback, ctx );
expect( ret ).to.equal( needl, 'ret value was forwarded' );

function callback() { }
function callback() {}
} );
} );

Expand All @@ -555,7 +555,7 @@ describe( 'Collection', () => {
sinon.assert.calledWithExactly( spy, callback, ctx );
expect( ret ).to.deep.equal( [ needl ], 'ret value was forwarded' );

function callback() { }
function callback() {}
} );
} );

Expand Down Expand Up @@ -700,7 +700,7 @@ describe( 'Collection', () => {
} );

it( 'does not chain', () => {
const returned = collection.bindTo( new Collection() ).using( () => { } );
const returned = collection.bindTo( new Collection() ).using( () => {} );

expect( returned ).to.be.undefined;
} );
Expand Down
Loading