0.0.10 • Published 8 years ago

decentraleyes-logs v0.0.10

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

decentraleyes-logs

Decentraleyes.net Logs service reference implementation

Architecture

Every service in Decentraleyes.net is shipped as a standalone module to allow SysOps the freedom to:

  1. Determine whether or not they use each module;
  2. Determine when/if they upgrade them; and
  3. Change or even entirely rewrite them from scratch.

Each service module implements an interface made of public methods and routes. If the public interface is maintained, Decentraleyes.net doesn't care what amount of actual work is performed within the service as long as it succeeds and generates a result expected by the user per the documented interface contract of the service.

For example, a SysOp might not want to use MongoDB or might even want to use a database they created. Such a user could create a new service and write the logic needed to use their custom database while providing service as expected through Decentraleyes.net including beacons, notifications and so on.

service-options.json

The service-options.json file lets the SysOp set certain options that simply don't make sense to store in the database and/or edit (or even expose) through the web front end. Any standard text editor can be used to change the contents of service-options.json. It is simply a JavaScript Object Notation (JSON) file.

logs

Defines an object containing one or more log definitions. These are what controls which logs are avaialble at runtime. The program logic iterates these entries in this file and creates one log per entry corresponding to the entry and its configuration.

For information about the configuration options (which are all passed directly to the Winston logger), view Winston's documentation.

Sets the options for the

Public Methods

load (express, mongoose)

Loads the API service and binds its routes at the configured mount point. HTTP requests can not be processed until the service is loaded.

createLog (name, options)

Creates a new named logger with the specified options. For each named log you create, you are expected to provide an options JSON block with the same name as follows:

"system": {
  "console": {
    "level": "debug",
    "colorize": true,
    "label": "system"
  },
  "file": {
    "filename": "system.log",
    "level": "debug"
  }
}

listLogs (callback)

Retrieves a list of usable logs running in the system.

getLog (name)

Retrieves the named log for use.

writeMessage (name, message, callback)

Writes a message to the named log.

Public Routes

GET /

Retrieves the list of loggers currently running.

GET /:logName

Retrieves the list of log messages for the specified logger.

POST /:logName

Stores a message to the named log.

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago