Commit Graph

47 Commits

Author SHA1 Message Date
Andrew Stewart 8a582fcf8d _.arity call no longer necessary 2015-07-13 14:08:21 -07:00
Andrew Stewart 843e0a3217 Simplify logger
This commit adds a simplified logging system, with two primary methods:

- `Logger#log(String) :: void` (for normal logging)
- `Logger#debug(String) :: void` (for debug logging)

This helps dramatically simplify logging infrastructure, as well as
enabling simpler toggling of log modes.

The configuration values for the Logger have also been updated:

- `logger :: Function` - function to log output to (both normal + debug)
- `silent :: Boolean` - whether to log default normal messages or not (`--silent` flag)
- `debug  :: Boolean` - whether or not to log debug output (`--debug` flag)

Additionally, the following CLI flags are supported re: logging:

- `--silent` disables normal logging (will override all other settings)
- `--debug` enables debug logging

Deprecation notices have been added for old log methods, with first-run
messages to this effect.

This change should have negligible impact on end-users, with minor
inconvenience for library developers, as they need to switch their
logging function calls over.

Logging configuration is still possible via both
`Cylon.Config.update(Object)`, and directly calling
`Cylon.Logger.setup(Object)`.
2015-07-13 14:05:12 -07:00
Andrew Stewart def91ffe53 Split apart MCP, API manager, exports 2015-06-29 08:25:07 -07:00
Andrew Stewart 9165ab36b4 Extract API from core 2015-01-08 10:02:14 -08:00
Andrew Stewart eccdde81a9 Update copyright years 2015-01-07 12:58:50 -08:00
Andrew Stewart 7109a9d303 Fix API errors, add slight simplifications 2014-12-17 16:51:48 -08:00
Andrew Stewart ac6b09fe50 Clean up lib for JSHint 2014-12-15 11:15:29 -08:00
Andrew Stewart 277d4a51ee Correct API errors 2014-11-06 09:10:56 -08:00
Andrew Stewart 9be0f779ae Update dependencies 2014-10-20 14:38:41 -07:00
Andrew Stewart 50f3ece923 Add basic error handling 2014-08-01 13:04:39 -07:00
Andrew Stewart c97514689b Only look for command params in POST bodies 2014-07-17 12:07:49 -07:00
Andrew Stewart 4f66bdeb51 Namespace API routes under '/api' 2014-07-15 12:33:04 -07:00
Andrew Stewart f0d8b0360b Remove `self` references in favor of #bind 2014-07-03 09:35:24 -07:00
Andrew Stewart af8cfbe333 Fix JSHint errors 2014-06-16 13:09:13 -07:00
Andrew Stewart ca749fd03e Fix an edge case and improve tests for API 2014-06-16 12:22:11 -07:00
Andrew Stewart 587efe2fee Rename API variables for less confusion
api.express => the Express instance
api.server  => the actual server (@express or a https.Server instance)
2014-06-16 08:44:52 -07:00
Andrew Stewart 9b352feeae Move API command param parsing to middleware 2014-06-04 15:54:23 -07:00
Andrew Stewart ac0a69e63f Move API routes to their own file 2014-06-04 13:39:30 -07:00
Andrew Stewart 789ce02ad0 Organize server creation into new function 2014-06-04 13:21:15 -07:00
Andrew Stewart a4cfc4b8ec Improve authentication middleware mounting 2014-06-04 13:17:17 -07:00
Andrew Stewart 014574a545 Move SSL certs to live under api dir 2014-06-04 11:58:54 -07:00
Andrew Stewart 6bc1e9d944 Move configuration to API class 2014-06-04 11:51:07 -07:00
Andrew Stewart e08a5df88b Bump Express version to 4.4.1 2014-06-04 11:06:02 -07:00
Andrew Stewart c22ef95239 Remove Logger from global namespace 2014-05-13 19:44:40 -07:00
Andrew Stewart a3974f38b7 Remove node-namespace from API 2014-05-07 15:19:23 -07:00
Javier Cervantes 3caeb47b3a Removing unused requires 2014-04-24 11:25:56 -05:00
Javier Cervantes f05025ba68 Removing wrong conditional in api 2014-04-24 11:25:45 -05:00
Javier Cervantes 394691a8f2 Refactoring api optional ssl logic 2014-04-24 11:18:20 -05:00
Javier Cervantes 40b3db1dce Changing how ssl is configured
Expected configuration:

{
  ssl: {
    key: "/path/to/key",
    cert: "/path/to/cert"
  }
}

If ssl is false, use plain HTTP. If it's an empty object (the default)
use our self-signed certs. If it's set up like above, use the provided
certs.
2014-04-23 17:56:42 -05:00
Javier Cervantes 8f746f1d27 Renaming https to generic node 2014-04-23 17:55:42 -05:00
Javier Cervantes cc3dac9442 Adding optional ssl param in API
By default http is used for api, but you can pass a param to use ssl.

This is the same behaviour that we have currently in robot.
2014-04-23 17:02:25 -05:00
Andrew Stewart fcd771cadc Provide more indication where API is listening 2014-04-14 11:27:48 -07:00
Andrew Stewart c5428d89ab Allow Content-Type header to be set for CORS 2014-04-11 19:23:13 -07:00
Andrew Stewart 9e781a2ea1 Add basic tests for API server and routes 2014-04-11 12:33:32 -07:00
Andrew Stewart 1c56b5942f Implement Server-Sent-Events for device events 2014-04-08 13:21:03 -07:00
Andrew Stewart cf31cfa7b9 Switch from Express-IO to plain Express 2014-04-08 11:52:53 -07:00
Andrew Stewart 4b409f7777 Add CORS param for API config 2014-04-08 10:58:58 -07:00
Andrew Stewart c81740e339 Add basic auth support to API 2014-04-03 16:04:11 -07:00
Andrew Stewart 29b7db0de8 Add support for manually specifying cert/key files 2014-04-03 15:03:21 -07:00
Andrew Stewart ea022d3880 Implement HTTPS API with self-signed cert
Switches API to serve all requests over HTTPS, using a self-signed SSL
certificate.
2014-04-03 14:32:56 -07:00
Andrew Stewart 34324dabd5 Clean up API logic 2014-04-03 12:28:27 -07:00
Andrew Stewart 2acc07b443 Fix error with /robots route in API 2014-03-25 10:16:11 -07:00
xixebombilla 642c5c8b1e 210 need fix merge 2014-02-27 16:45:14 -06:00
xixebombilla 8644399276 210 comments JS 2014-02-27 16:42:33 -06:00
Andrew Stewart 204bf89685 Remove trailing whitespace 2014-02-27 14:14:51 -08:00
deadprogram c28baa8eeb Refactor api, basestar & config to pure JS style 2014-02-27 10:58:50 -08:00
deadprogram b27756abfc WIP on pure JS revamp 2014-02-27 06:44:53 -08:00