2017 © Pedro Peláez
 

symfony-bundle logger

Trinity Logger bundle

image

trinity/logger

Trinity Logger bundle

  • Wednesday, December 13, 2017
  • by modpreneur
  • Repository
  • 17 Watchers
  • 0 Stars
  • 4,108 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 23 Versions
  • 0 % Grown

The README.md

trinity-logger

This bundle is reconstructed for new elasticsearch (v5) and the read me is not actualized yet. TODO

Coverage Status Build Status, (*1)

Bundle for storing and loading logs in ElasticSearch database., (*2)

Write issue if you found something that doesn't work as it should., (*3)

Logger creates new index each day in format YYYY-MM-DD. It works with environment and as for now two types are used. Development and Production logs are written into same index. The test environment adds prefix 'test-' before the index., (*4)

Thanks to this the logs may be viewed directly by using URL:, (*5)

http:\\elastic_host:port\YYYY-MM-DD\LogName\LogId

for example:, (*6)

trinity_logger:
  elastic_logs:
    elastic_host: '127.0.0.1:9200'
    managed_index: 'necktie'

Configured index can be changed when method is called., (*7)

Classic call:, (*8)

$this->get('trinity.elastic.read.log.service')->getCount('ExceptionLog');

Call different index:, (*9)

$this->get('trinity.elastic.read.log.service')->setIndex('venice')->getCount('ExceptionLog');

For searching it is required to know where is entity class stored. Most classes are stored on same place and therefor they can be added into configuration as follow:, (*10)

trinity_logger:
  elastic_logs:
    elastic_host: '127.0.0.1:9200'
    managed_index: 'necktie'
    entities_path: 'Necktie\\AppBundle\\Entity'

When we use nqlQuery (see trinity/search for more about used nqlQuery) we can call:, (*11)

$entities = $this->get('trinity.elastic.read.log.service')->getByQuery($nqlQuery);

If entity definition is stored elsewhere, we go for example as this:, (*12)

$entities = $this->get('trinity.elastic.read.log.service')
    ->setEntityPath('Necktie\\PaymentBundle\\Entity')
    ->getByQuery($nqlQuery);

Note: ElasticSearch is noSQL database.... NO!!!SQL therefor it will go with only queries under one entity. If you need join something use relation based SQL database., (*13)

As main use of this bundle for now is Necktie, following values are used as default and doesn't require configuration. managed_index: 'necktie' entities_path: 'Necktie\AppBundle\Entity', (*14)

The Versions