package cn.reghao.autodop.dmaster.machine.model.po;

import cn.reghao.autodop.common.msg.pub.dto.node.NodeLogDTO;
import cn.reghao.autodop.dmaster.util.db.BaseDocument;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * 节点应用运行时日志
 *
 * @author reghao
 * @date 2021-06-11 09:48:14
 */
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Data
@Document("NodeLog")
public class NodeLog extends BaseDocument {
    private String machineId;
    private String appId;
    private long timestamp;
    private String level;
    private String threadName;
    private String loggerName;
    private String message;

    public NodeLog(NodeLogDTO nodeLogDTO) {
        this.machineId = nodeLogDTO.getMachineId();
        this.appId = nodeLogDTO.getAppId();
        this.timestamp = nodeLogDTO.getTimestamp();
        this.level = nodeLogDTO.getLevel();
        this.threadName = nodeLogDTO.getThreadName();
        this.loggerName = nodeLogDTO.getLoggerName();
        this.message = nodeLogDTO.getMessage();
    }
}
