package com.haobang.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;


@ConfigurationProperties(prefix = "syslog")
public class SyslogConfig {

    // 读取字符串属性
    @Value("${syslog.tcp.port}")
    private int tcpPort;
    // 读取字符串属性
    @Value("${syslog.udp.port}")
    private int udpPort;
    // 读取字符串属性
    @Value("${syslog.max.frame.length}")
    private int maxFrameLength;
    // 读取字符串属性
    @Value("${syslog.buffer.size}")
    private int bufferSize;

    // Getter 和 Setter 方法
    public int getTcpPort() {
        return tcpPort;
    }

    public void setTcpPort(int tcpPort) {
        this.tcpPort = tcpPort;
    }

    public int getUdpPort() {
        return udpPort;
    }

    public void setUdpPort(int udpPort) {
        this.udpPort = udpPort;
    }

    public int getMaxFrameLength() {
        return maxFrameLength;
    }

    public void setMaxFrameLength(int maxFrameLength) {
        this.maxFrameLength = maxFrameLength;
    }

    public int getBufferSize() {
        return bufferSize;
    }

    public void setBufferSize(int bufferSize) {
        this.bufferSize = bufferSize;
    }

    @Override
    public String toString() {
        return String.format("SyslogConfig[tcpPort=%d, udpPort=%d, maxFrameLength=%d, bufferSize=%d]",
                tcpPort, udpPort, maxFrameLength, bufferSize);
    }
}