-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from cwahbong/log-plugin-rfc
Log plugin rfc
- Loading branch information
Showing
3 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
- Feature Name: log | ||
- Start Date: 2016-05-07 | ||
|
||
# Summary | ||
|
||
Log plugin collects all log messages from all plugins. | ||
|
||
# Motivation | ||
|
||
Println debugging is the fastest but not the best way to generate visible | ||
informations. For example, println logging would be difficult if we are in | ||
rustbox implemented terminal GUI. Plugins of Swiboe can run as different | ||
processs at different machines. A centralized logger can also help us to collect | ||
all helpful informations between different plugins. | ||
|
||
# Detailed design | ||
|
||
Current dummy implementation stills uses `println!`. The following features may be | ||
added later. | ||
|
||
- Configurable log level. | ||
- Configurable log target: not only to console output, but also to file. | ||
|
||
# API | ||
|
||
Each log function represents each logging level, with the same request and | ||
response foramt. Currently four levels are provided, listed as follows. | ||
|
||
- `log.debug` | ||
- `log.info` | ||
- `log.warn` | ||
- `log.error` | ||
|
||
## log.{debug, info, warn, error} | ||
|
||
Calling these functions to send log messages. | ||
|
||
### Request | ||
|
||
- message: The message which will be logged. | ||
- time: The timestamp in RFC 3339 format with timezone information. | ||
|
||
Json schema: | ||
|
||
~~~json | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"message": { | ||
"type": "string" | ||
}, | ||
"time": { | ||
"type": "string", | ||
}, | ||
} | ||
} | ||
~~~ | ||
|
||
Example: | ||
|
||
~~~json | ||
{ | ||
"message": "Example message", | ||
"time": "2016-04-15T03:03:03Z", | ||
} | ||
~~~ | ||
|
||
### Response | ||
|
||
Log function always respond an empty json object. | ||
|
||
Json schema: | ||
|
||
~~~json | ||
{ | ||
"type": "object", | ||
} | ||
~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters