ride/app-filtered-log

Adds filtered log support

1.0.0 2016-09-21 12:37 UTC

This package is auto-updated.

Last update: 2024-04-23 14:59:28 UTC


README

This modules allows you to create a filtered log from your properties.

Options

You can specify some options in parameters.json, which will alter the behaviour of the log.

log.filtered.file

This parameter defaults to %application%/data/log/%environment%.filtered.log.

log.levels

This parameter takes an array of log levels.

Available levels are:

  • "E" for error
  • "I" for information
  • "W" for warning
  • "D" for debug

Example:

// parameters.json
{
    // ...

    "log.levels" : ["E", "I", "D", "W"]
}

log.fields

This parameter takes an array of fields which can be showed in your log messages. This order of the fields will determine the order in which they appear in log messages.

Available fields are:

  • "id" -"date" -"client" -"duration" -"source" -"memory" -"level" -"title" -"description"

Example:

// parameters.json
{
    // ...

    "log.fields" : ["duration", "source", "title", "description"]
}

log.sources

This parameter takes an array of sources. Examples are "app" or "database".

Example:

// parameters.json
{
    // ...

    "log.sources" : ["app", "controller"]
}

log.separator

A separator can be specified to override the default column separator. This parameter requires a string value.

Example:

// parameters.json
{
    // ...

    "log.separator" : "::"
}

log.colors

By enabling this option, the log will be colored. This parameter requires a boolean value.

Example:

// parameters.json
{
    // ...

    "log.colors" : true
}

log.file

Specify a different log file by providing a path.

Example:

// parameters.json
{
    // ...

    "log.file": "/sites/ridme/htdocs/debug.log",
}

Todo

  • Field specific colors.
  • Add a cli command to start logging with an optional specified config.