configlog

package module
v0.0.0-...-ff22dbd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2017 License: MIT Imports: 12 Imported by: 6

README

configlog

Package for simpe config load and enable logfile If logfile not found, log output will be printed to STDOUT

###chanelog

####16.12.2015

For support logrotate added log file watcher. It watch for rename, delete.

####01.12.2015

Disabled reload by time.

####use:

$ go get github.com/andboson/configlog

sample dir structure:

config/app.yml
      /production/app.yml
tests/default_tests.go
main.go

If folder production exists config file will be loaded form there

Sample config file

port: 8001
debug: true
logfile: 'log/logfile.log'
database:
    host: '127.0.0.1'
    pg_base: pgbase
    pg_user: root
    pg_pass: root
    pg_host: '127.0.0.1'
    db_port: 5432
    sslmode: disable
    sslcert: ''
    sslkey: ''
    sslrootcert: ''

redis:
    redis_host: '127.0.0.1'
    redis_port: 6379
    redis_pass: ''

log file loaded from logfile config value

Sample use:

import (
    . "github.com/andboson/configlog"
)



 debug, error := AppConfig.String("debug")

more see github.com/olebedev/config

Documentation

Index

Constants

View Source
const (
	CONFIG_DIR        = "config"
	PRODUCTION_FOLDER = "production"
	CONFIG_FILE       = "app.yml"
)

Variables

View Source
var AppConfig *config.Config
View Source
var CurrDirectory string
View Source
var Out *os.File

Functions

func EnableLogfile

func EnableLogfile(logfileName string) *os.File

func ReloadConfigLog

func ReloadConfigLog()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL