Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jimlambie committed Dec 31, 2015
1 parent c199731 commit 8815434
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 80 deletions.
55 changes: 0 additions & 55 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,58 +35,3 @@ The `use` method does different things depending on what is passed to it -
"collections": "test/acceptance/workspace/collections",
"endpoints": "test/acceptance/workspace/endpoints"
},

"logging": {
"enabled": true,
"path": "./log",
"filename": "dadi-api",
"extension": "log"
},

var app = require('dadi-api');
var config = require('dadi-api').Config;
var model = require('dadi-api').Model;
var log = require('dadi-api').Log;

this.log = log.get().child({module: 'your module name'});
this.log.info('your log message');

http://api.example.com/api/collections

```
{
"collections": [
{
"version": "1.0",
"database": "library",
"name": "authors",
"slug": "authors",
"path": "/1.0/library/authors"
},
{
"version": "1.0",
"database": "library",
"name": "books",
"slug": "books",
"path": "/1.0/library/books"
}
]
}
```

http://api.example.com/1.0/library/books/stats

```
{
"count": 34042,
"size": 3599267936,
"averageObjectSize": 105730,
"storageSize": 3921256448,
"indexes": 2,
"totalIndexSize": 2714432,
"indexSizes": {
"_id_": 1111936,
"title_1": 1602496
}
}
```
44 changes: 44 additions & 0 deletions docs/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,50 @@ module.exports.model = {}
module.exports.model.settings = { authenticate : false }
```

## List All Collections

http://api.example.com/api/collections

```
{
"collections": [
{
"version": "1.0",
"database": "library",
"name": "authors",
"slug": "authors",
"path": "/1.0/library/authors"
},
{
"version": "1.0",
"database": "library",
"name": "books",
"slug": "books",
"path": "/1.0/library/books"
}
]
}
```

## View Collection Statistics

http://api.example.com/1.0/library/books/stats

```
{
"count": 34042,
"size": 3599267936,
"averageObjectSize": 105730,
"storageSize": 3921256448,
"indexes": 2,
"totalIndexSize": 2714432,
"indexSizes": {
"_id_": 1111936,
"title_1": 1602496
}
}
```

## Collection Configuration Requests

### Creating a new collection
Expand Down
32 changes: 7 additions & 25 deletions docs/logger.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,25 @@
![Serama](../serama.png)

# Logger
# Logging

## Overview

This module exposes three methods -

`debug`

`stage`

`prod`

Depending on the level specified in the config.json file, calls to these messages either log to the file system, or do nothing.

## Configuration

```
"logging": {
"enabled": true,
"level": "DEBUG",
"path": "./log",
"filename": "dadi-api",
"extension": "log",
"dateFormat": "",
"messageFormat": "<%= label %> - <%= date %> - <%= message %>"
"extension": "log"
}
```

## Levels

* 'DEBUG' - most verbose, all logging is persisted
* 'STAGE' - medium logging, calls to `stage`, and `prod` are persisted. Calls to `debug` are ignored
* 'PROD' - least amount of logging, only calls to `prod` are persisted. All others are ignored

## Example Usage

`var logger = require('./dadi/lib/log');`

`logger.debug('debug message');`
```
var Log = require('dadi-api').Log;
`logger.prod('message for production');`
var logger = Log.get().child({module: 'your module name'});
logger.info('your log message');
```

0 comments on commit 8815434

Please sign in to comment.