コード例 #1
0
def test_access_logs_with_format_name():
    config = '''
        http {
            access_log /path/to/main.log main gzip=5 buffer=32k flush=1m;
            server {
                access_log /path/to/test.log 'te st';
            }
        }
    '''
    logs = dict(config_parser.get_access_logs(config))
    assert len(logs) == 2
    assert logs['/path/to/main.log'] == 'main'
    assert logs['/path/to/test.log'] == 'te st'
コード例 #2
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def test_access_logs_with_format_name():
    config = '''
        http {
            access_log /path/to/main.log main gzip=5 buffer=32k flush=1m;
            server {
                access_log /path/to/test.log 'te st';
            }
        }
    '''
    logs = dict(config_parser.get_access_logs(config))
    assert len(logs) == 2
    assert logs['/path/to/main.log'] == 'main'
    assert logs['/path/to/test.log'] == 'te st'
コード例 #3
0
ファイル: test_config_parser.py プロジェクト: ngxtop/ngxtop
def test_access_logs_with_format_name():
    config = """
        http {
            access_log /path/to/main.log main gzip=5 buffer=32k flush=1m;
            server {
                access_log /path/to/test.log 'te st';
            }
        }
    """
    logs = dict(config_parser.get_access_logs(config))
    assert len(logs) == 2
    assert logs["/path/to/main.log"] == "main"
    assert logs["/path/to/test.log"] == "te st"
コード例 #4
0
def test_get_access_logs_no_format():
    config = '''
        http {
            # ubuntu default
            access_log /var/log/nginx/access.log;

            # syslog is a valid access log, but we can't follow it
            access_log syslog:server=address combined;

            # commented
            # access_log commented;

            server {
                location / {
                    # has parameter with default format
                    access_log /path/to/log gzip=1;
                }
            }
        }
    '''
    logs = dict(config_parser.get_access_logs(config))
    assert len(logs) == 2
    assert logs['/var/log/nginx/access.log'] == 'combined'
    assert logs['/path/to/log'] == 'combined'
コード例 #5
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def test_get_access_logs_no_format():
    config = '''
        http {
            # ubuntu default
            access_log /var/log/nginx/access.log;

            # syslog is a valid access log, but we can't follow it
            access_log syslog:server=address combined;

            # commented
            # access_log commented;

            server {
                location / {
                    # has parameter with default format
                    access_log /path/to/log gzip=1;
                }
            }
        }
    '''
    logs = dict(config_parser.get_access_logs(config))
    assert len(logs) == 2
    assert logs['/var/log/nginx/access.log'] == 'combined'
    assert logs['/path/to/log'] == 'combined'