Skip to content

Commit

Permalink
melhora o nível dos logs do monjo
Browse files Browse the repository at this point in the history
  • Loading branch information
rdlopes committed May 26, 2011
1 parent f21ed40 commit 1039791
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main/java/org/monjo/core/Monjo.java
Expand Up @@ -167,7 +167,7 @@ private void initialize(DB mongoDb, Class<T> clasz, String collectionName, Comma
@SuppressWarnings("unchecked")
public Id insert(T identifiableDocument) {
DBObject dbObject = getConverter().from(identifiableDocument).toDocument();
logger.debug("inserting an item:{} in collection:{}", dbObject, collection.getName());
logger.info("inserting an item:{} in collection:{}", dbObject, collection.getName());
collection.insert(dbObject);
identifiableDocument.setId((Id) dbObject.get("_id"));
return (Id) dbObject.get("_id");
Expand All @@ -177,7 +177,8 @@ public Id insert(T identifiableDocument) {
* Remove all items from collection
*/
public void removeAll(){
logger.debug("dropping collection {}", collection.getName());
// carai mano, o que essa cara ta fazendo !?
logger.warn("dropping collection {}", collection.getName());
collection.drop();
}

Expand All @@ -187,7 +188,7 @@ public void removeAll(){
*/
public void removeBy(Id id){
BasicDBObject basicObject = new BasicDBObject("_id", id);
logger.debug("removing item:{} from collection:{}", basicObject, collection.getName());
logger.warn("removing item:{} from collection:{}", basicObject, collection.getName());
removeByCriteria(basicObject);
}

Expand All @@ -196,7 +197,7 @@ public void removeBy(Id id){
* @param criteria
*/
public void removeByCriteria(DBObject criteria){
logger.debug("removing item(s):{} from collection:{}", criteria, collection.getName());
logger.warn("removing item(s):{} from collection:{}", criteria, collection.getName());
collection.remove(criteria);
}

Expand All @@ -221,7 +222,7 @@ The save() command in the mongo shell provides a shorthand syntax to
@SuppressWarnings("unchecked")
public Id save(T identifiableDocument) {
DBObject dbObject = getConverter().from(identifiableDocument).toDocument();
logger.debug("inserting an item:{} in collection:{}", dbObject, collection.getName());
logger.info("inserting an item:{} in collection:{}", dbObject, collection.getName());
collection.save(dbObject);
identifiableDocument.setId((Id) dbObject.get("_id"));
return (Id) dbObject.get("_id");
Expand Down Expand Up @@ -252,7 +253,7 @@ public DBObject createUpdateWithAddSetCriteria(T identifiableDocument) {


public void update(DBObject query, DBObject update) {
logger.debug("updating an item:{} for {} in collection:{}", new Object[] {query, update, collection.getName()});
logger.info("updating an item:{} for {} in collection:{}", new Object[] {query, update, collection.getName()});
collection.update(query, update, true, false);
}

Expand All @@ -273,7 +274,7 @@ public Id updateInnerObject(T identifiableDocument, String fieldname) throws Ill
Object innerObject = list.get(0);
DBObject dbObject = getConverter().from(identifiableDocument).action(Operation.UpdateInnerObject).toDocument();
DBObject dbObject2 = ((MonjoConverter<T>) getConverter().setPrefix(fieldname)).getIdDocument(innerObject);
logger.debug("updating an item:{} for {} in collection:{}", new Object[] {dbObject2, dbObject, collection.getName()});
logger.info("updating an item:{} for {} in collection:{}", new Object[] {dbObject2, dbObject, collection.getName()});
collection.update(dbObject2, dbObject, true, false);
return identifiableDocument.getId();

Expand Down

0 comments on commit 1039791

Please sign in to comment.