GithubHelp home page GithubHelp logo

new_lager's Introduction

new_lager

It provides an user-defined handler to rotate the log files everyday base on the lager project.

Examplle

1. configurate in rebar.config file:
{parse_transform, lager_transform}

2. configurate in sys.config file:
[
	{lager, [
        {log_root, "log/"},
        {colored, true},

        {async_threshold, 5000},
        {async_threshold_window, 500},
        {error_logger_flush_queue, true},
        {error_logger_flush_threshold, 1000},
        {error_logger_hwm, 200},

        {crash_log, "log/crash.log"},
        {crash_log_msg_size, 65536},
        {crash_log_size, 10485760},
        {crash_log_date, "$D0"},
        {crash_log_count, 30},

        {handlers, [
			{lager_console_backend, [
				{level, debug},
				{formatter_config, [time, color, " [", severity, "] ", module, ":", function, ":", line, " ", message, "\e[0m\r\n"]}
			]},
			{lager_file_backend, [
				{level, debug},
				{formatter_config, [date, " ", time, " [", severity, "] ", module, ":", function, ":", line, " ", message, "\n"]},
				{file, "log/console.log"},
				{size, 10485760},
				{date, "$D0"},
				{count, 20}
			]},
			{lager_file_backend, [
				{level, error},
				{formatter_config, [date, " ", time, " [", severity, "] ", module, ":", function, ":", line, " ", message, "\n"]},
				{file, "log/error.log"},
				{size, 10485760},
				{date, "$D0"}
			]},
			{new_lager, [
				{level, debug},
				{formatter_config, [date, " ", time, " [", severity, "] ", module, ":", function, ":", line, " ", message, "\n"]},
				{path, "log/"}
			]}
		]}
	]}
].

3. add new_lager to xxx.app.src file:
{applications, [
    kernel,
    stdlib,
    sasl,
    ssl,
    crypto,
    parse_trans,
    new_lager
]}

4. include lib_hrl file:
-include_lib("new_lager/include/log.hrl").

new_lager's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.