Skip to content

Commit

Permalink
remove some logs (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecarriou committed Jan 11, 2020
1 parent 4a5e7a9 commit 9f85230
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 70 deletions.
19 changes: 1 addition & 18 deletions src/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,8 @@ DatabaseCollection.prototype.insert = function insert(document) {
$metamodel.prepareObject(obj, $metamodel.getModel(this.name));

exports.store[this.name][obj[$mson.ID]] = obj;
result.push(obj[$mson.ID]);

$log.documentInserted(obj[$mson.ID], this.name);
result.push(obj[$mson.ID]);

Component = $component.get(this.name);
if (Component) {
Expand Down Expand Up @@ -873,12 +872,6 @@ DatabaseCollection.prototype.update = function update(query, update, options) {

docs[i][attributeName] = update[attributeName];

$log.documentUpdated(
docs[i][$mson.ID],
this.name,
attributeName,
update[attributeName]
);
result.push(docs[i][$mson.ID]);

if ($helper.isRuntime() && $helper.getRuntime().require('db')) {
Expand Down Expand Up @@ -936,12 +929,6 @@ DatabaseCollection.prototype.update = function update(query, update, options) {

docs[i][attributeName] = update[attributeName];

$log.documentUpdated(
docs[i][$mson.ID],
this.name,
attributeName,
update[attributeName]
);
result.push(docs[i][$mson.ID]);

if ($helper.isRuntime() && $helper.getRuntime().require('db')) {
Expand Down Expand Up @@ -1002,7 +989,6 @@ DatabaseCollection.prototype.remove = function remove(query) {

delete exports.store[this.name][id];

$log.documentRemoved(id, this.name);
result.push(id);

component = $component.get(id);
Expand Down Expand Up @@ -1038,7 +1024,6 @@ DatabaseCollection.prototype.remove = function remove(query) {

delete exports.store[this.name][id];

$log.documentRemoved(id, this.name);
result.push(id);

component = $component.get(id);
Expand Down Expand Up @@ -1070,8 +1055,6 @@ DatabaseCollection.prototype.remove = function remove(query) {

delete exports.store[this.name][id];

$log.documentRemoved(id, this.name);

if (coreDb.indexOf(this.name) === -1) {
component = $component.get(id);
if (component) {
Expand Down
51 changes: 0 additions & 51 deletions src/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -1206,54 +1206,3 @@ exports.historyDocumentUpdated = function historyDocumentRemoved(
"')"
);
};

/**
* @method documentRemoved
* @param {String} id id of the document
* @param {String} collection name of the collection
* @description A document from a collection was removed
*/
exports.documentRemoved = function documentRemoved(id, collection) {
getLogger().debug(
"the document '" + id + "' was removed (collection '" + collection + "')"
);
};

/**
* @method documentInserted
* @param {String} id id of the document
* @param {String} collection name of the collection
* @description A document was inserted into a collection
*/
exports.documentInserted = function documentInserted(id, collection) {
getLogger().debug(
"the document '" + id + "' was inserted (collection '" + collection + "')"
);
};

/**
* @method documentUpdated
* @param {String} id id of the document
* @param {String} collection name of the collection
* @param {String} property property of the document
* @param {String} value new value of the property
* @description A document was updated
*/
exports.documentUpdated = function documentUpdated(
id,
collection,
property,
value
) {
getLogger().debug(
"the property '" +
property +
"' of the document '" +
id +
"' was updated with the value '" +
value +
"' (collection '" +
collection +
"')"
);
};
10 changes: 9 additions & 1 deletion test/module/db-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,15 @@ describe('System Runtime db component', () => {
});

it('can add a document', () => {
const docAdded = db._Runtime.insert({
let docAdded = db._Runtime.insert({
'_id': 'runtime1',
'version': '0.0.0'
});

expect(docAdded[0]).equal('runtime1');

// try to insert the same document
docAdded = db._Runtime.insert({
'_id': 'runtime1',
'version': '0.0.0'
});
Expand Down

0 comments on commit 9f85230

Please sign in to comment.