ZCLibLog
载入中...
搜索中...
未找到
lambda.hpp
浏览该文件的文档.
1// Copyright 2026 CZF-H
2// Licensed under the Apache License, Version 2.0
3
4//
5// Created by wanjiangzhi on 2026/4/7.
6//
7
8#ifndef ZCLIBLOG_EXECUTORS_LAMBDA_HPP
9#define ZCLIBLOG_EXECUTORS_LAMBDA_HPP
10
11#include "basic_executor.hpp"
12#include <functional>
13
14namespace ZCLibLog {
15 namespace executors {
22 using constructible = std::function<void(ELString, ELogLevel)>;
23 explicit lambda(constructible constructed) : constructed(std::move(constructed)) {}
24 void do_execute(ELString msg, ELogLevel lv) override {
25 constructed(msg, lv);
26 }
27 private:
28 constructible constructed;
29 };
30 }
31
38 return executor::make<executors::lambda>(std::move(constructed));
39 }
40}
41
42#endif //ZCLIBLOG_EXECUTORS_LAMBDA_HPP
执行器包装类
Definition logger_types.hpp:133
static executor make(Args &&... args)
通过工厂函数构造
Definition logger_types.hpp:161
ZCLibLog的命名空间
Definition android_log.hpp:16
executor lambda_wrapper(executors::lambda::constructible constructed)
辅助创建lambda thunk执行器
Definition lambda.hpp:37
执行器的基类抽象类
Definition logger_types.hpp:106
ELogLevel ELogLevel
简化写法
Definition logger_types.hpp:116
ELString ELString
简化写法
Definition logger_types.hpp:114
C++ lambda函数thunk执行器
Definition lambda.hpp:21
void do_execute(ELString msg, ELogLevel lv) override
自定义执行器需要重载的执行函数
Definition lambda.hpp:24
lambda(constructible constructed)
Definition lambda.hpp:23
std::function< void(ELString, ELogLevel)> constructible
Definition lambda.hpp:22