#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from logging import Logger
import logging.config

from oh_my_logging.builders import LoggerBuilderFactory
from oh_my_logging.decorators import log_args


def setup_module(module):
    global dictConfig
    dictConfig = {
        'version': 1,
        'root': {
            'level': 'DEBUG',
            'handlers': ['memory'],
        },
        'handlers': {
            'memory': {
                'class': 'oh_my_logging.handlers.MemoryHandler',
                'formatter': 'default',
            },
        },
        'formatters': {
            'default': {
                'format': '%(message)s',
            },
        },
    }
    LoggerBuilderFactory.unsafe_clear()
    LoggerBuilderFactory(dictConfig)


def test_log_args_on_function():
    @log_args
    def func(name, num):
        pass

    func('oh_my_logging', 123)

    logger = LoggerBuilderFactory().builder(func).build()
    assert logger.root.handlers[0].message == 'params: %s' % 'name=oh_my_logging, num=123'

ae6f72e21ff8023016c8b836572c4f77cde95551
<mask token>

<mask token>


def test_log_args_on_function():

    @log_args
    def func(name, num):
        pass
    func('oh_my_logging', 123)
    logger = LoggerBuilderFactory().builder(func).build()
    assert logger.root.handlers[0
        ].message == 'params: %s' % 'name=oh_my_logging, num=123'

<mask token>


def setup_module(module):
    global dictConfig
    dictConfig = {'version': 1, 'root': {'level': 'DEBUG', 'handlers': [
        'memory']}, 'handlers': {'memory': {'class':
        'oh_my_logging.handlers.MemoryHandler', 'formatter': 'default'}},
        'formatters': {'default': {'format': '%(message)s'}}}
    LoggerBuilderFactory.unsafe_clear()
    LoggerBuilderFactory(dictConfig)


def test_log_args_on_function():

    @log_args
    def func(name, num):
        pass
    func('oh_my_logging', 123)
    logger = LoggerBuilderFactory().builder(func).build()
    assert logger.root.handlers[0
        ].message == 'params: %s' % 'name=oh_my_logging, num=123'

import sys
from logging import Logger
import logging.config
from oh_my_logging.builders import LoggerBuilderFactory
from oh_my_logging.decorators import log_args


def setup_module(module):
    global dictConfig
    dictConfig = {'version': 1, 'root': {'level': 'DEBUG', 'handlers': [
        'memory']}, 'handlers': {'memory': {'class':
        'oh_my_logging.handlers.MemoryHandler', 'formatter': 'default'}},
        'formatters': {'default': {'format': '%(message)s'}}}
    LoggerBuilderFactory.unsafe_clear()
    LoggerBuilderFactory(dictConfig)


def test_log_args_on_function():

    @log_args
    def func(name, num):
        pass
    func('oh_my_logging', 123)
    logger = LoggerBuilderFactory().builder(func).build()
    assert logger.root.handlers[0
        ].message == 'params: %s' % 'name=oh_my_logging, num=123'

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from logging import Logger
import logging.config

from oh_my_logging.builders import LoggerBuilderFactory
from oh_my_logging.decorators import log_args


def setup_module(module):
    global dictConfig
    dictConfig = {
        'version': 1,
        'root': {
            'level': 'DEBUG',
            'handlers': ['memory'],
        },
        'handlers': {
            'memory': {
                'class': 'oh_my_logging.handlers.MemoryHandler',
                'formatter': 'default',
            },
        },
        'formatters': {
            'default': {
                'format': '%(message)s',
            },
        },
    }
    LoggerBuilderFactory.unsafe_clear()
    LoggerBuilderFactory(dictConfig)


def test_log_args_on_function():
    @log_args
    def func(name, num):
        pass

    func('oh_my_logging', 123)

    logger = LoggerBuilderFactory().builder(func).build()
    assert logger.root.handlers[0].message == 'params: %s' % 'name=oh_my_logging, num=123'
