---
# Container descriptor
- descriptor: "pip-services:context-info:default:default:1.0"
  name: "pip-services-logging"
  description: "Logging microservice for pip-services"

# Console logger
- descriptor: "pip-services:logger:console:default:1.0"
  level: "trace"

# Performance counters that posts values to log
- descriptor: "pip-services:counters:log:default:1.0"
  level: "trace"

{{#if MEMORY_ENABLED}}
# In-memory persistence. Use only for testing!
- descriptor: "pip-services-logging:persistence-messages:memory:default:1.0"
- descriptor: "pip-services-logging:persistence-errors:memory:default:1.0"
{{/if}}

{{#if MONGO_ENABLED}}
# MongoDB Persistence for storing messages
- descriptor: "pip-services-logging:persistence-messages:mongodb:default:1.0"
  collection: {{MONGO_COLLECTION}}{{#unless MONGO_COLLECTION}}messages{{/unless}}
  connection:
    uri: {{{MONGO_SERVICE_URI}}}
    host: {{{MONGO_SERVICE_HOST}}}{{#unless MONGO_SERVICE_HOST}}localhost{{/unless}}
    port: {{MONGO_SERVICE_PORT}}{{#unless MONGO_SERVICE_PORT}}27017{{/unless}}
    database: {{MONGO_DB}}{{#unless MONGO_DB}}app{{/unless}}
  credential:
    username: {{MONGO_USER}}
    password: {{MONGO_PASS}}
    
# MongoDB Persistence for storing errors
- descriptor: "pip-services-logging:persistence-errors:mongodb:default:1.0"
  collection: {{MONGO_COLLECTION}}{{#unless MONGO_COLLECTION}}errors{{/unless}}
  connection:
    uri: {{{MONGO_SERVICE_URI}}}
    host: {{{MONGO_SERVICE_HOST}}}{{#unless MONGO_SERVICE_HOST}}localhost{{/unless}}
    port: {{MONGO_SERVICE_PORT}}{{#unless MONGO_SERVICE_PORT}}27017{{/unless}}
    database: {{MONGO_DB}}{{#unless MONGO_DB}}app{{/unless}}
  credential:
    username: {{MONGO_USER}}
    password: {{MONGO_PASS}}
{{/if}}

{{#unless MEMORY_ENABLED}}{{#unless MONGO_ENABLED}}
# Default in-memory persistence
- descriptor: "pip-services-logging:persistence-messages:memory:default:1.0"
- descriptor: "pip-services-logging:persistence-errors:memory:default:1.0"
{{/unless}}{{/unless}}

# Default controller
- descriptor: "pip-services-logging:controller:default:default:1.0"
  options:
    expire_cleanup_timeout: 1
    expire_logs_timeout: 1
    expire_errors_timeout: 30

# Common HTTP endpoint
- descriptor: "pip-services:endpoint:http:default:1.0"
  connection:
    protocol: "http"
    host: "0.0.0.0"
    port: 8080

# HTTP endpoint version 1.0
- descriptor: "pip-services-logging:service:http:default:1.0"

# Heartbeat service
- descriptor: "pip-services:heartbeat-service:http:default:1.0"

# Status service
- descriptor: "pip-services:status-service:http:default:1.0"