更新翻译

Signed-off-by: jlspcdd1227dd <12046126+jlspcdd1227dd@user.noreply.gitee.com>
This commit is contained in:
jlspcdd1227dd 2023-03-27 09:03:15 +00:00 committed by Gitee
parent 38702b71e9
commit e3a136e20f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 47 additions and 48 deletions

View File

@ -2583,62 +2583,62 @@ target_link_libraries(kylog-testpressure kylog)
> output log
| 类型 | statement |
| type | statement |
|---------------|---------------------------------|
| 输出debug级别日志 | #define klog_debug(fmt , ...) |
| 输出info级别日志 | #define klog_info(fmt , ...) |
| 输出notice级别日志 | #define klog_notice(fmt , ...) |
| 输出warning级别日志 | #define klog_warning(fmt , ...) |
| 输出error级别日志 | #define klog_err(fmt , ...) |
| 输出crit级别日志 | #define klog_crit(fmt , ...) |
| 输出alert级别日志 | #define klog_alert(fmt , ...) |
| 输出emerg级别日志 | #define klog_emerg(fmt , ...) |
| Output debug level log | #define klog_debug(fmt , ...) |
| Output info level log | #define klog_info(fmt , ...) |
| Output notice level log | #define klog_notice(fmt , ...) |
| Output warning level log | #define klog_warning(fmt , ...) |
| Output error level log | #define klog_err(fmt , ...) |
| Output crit level log | #define klog_crit(fmt , ...) |
| Output alert level log | #define klog_alert(fmt , ...) |
| Output emerg level log | #define klog_emerg(fmt , ...) |
> 初始化日志记录
> Initialize logging
| submodule | Programming language | statement | describe |
|-----|------|-----------------------------------|----------------------------------|
| 日志 | C | extern int | kdk_logger_init(const char *ini) | 初始化日志记录,也可以不调用该函数直接使用上方日志记录的宏,若以此方式运行,则程序会使用默认的日志配置文件 |
| log | C | extern int | kdk_logger_init(const char *ini) | Initialize the log record, or directly use the above log record macro without calling this function, if run in this way, the program will use the default log configuration file |
| | | Parameter Description | Return value description | |
| | | ini日志配置文件路径若传入NULL则会使用默认的日志配置文件 | int0表示成功非0表示失败 |
| | | iniLog configuration file path, if NULL is passed in, the default log configuration file will be used | int0 means success, non-zero means failure |
> 缓存区日志写入
> Buffer log write
| submodule | Programming language | statement | describe |
|-----|------|-------------|--------------------------------|
| 日志 | C | extern void | kdk_logger_flush() DESTRUCTOR; | 在异步写入的方式下,可以调用该函数手动将缓存区中的日志写入文件中 |
| log | C | extern void | kdk_logger_flush() DESTRUCTOR; | In the asynchronous writing mode, you can call this function to manually write the logs in the buffer to the file |
| | | Parameter Description | Return value description | |
| | | 无 | 无 |
> 设置日志存储目录
> Set the log storage directory
| submodule | Programming language | statement | describe |
|-----|------|-------------------------------------------------|---------------------------------------------------------|
| 日志 | C | extern int kdk_logger_setdir(const char* dpath) | 设置日志的存储目录若不设置非root程序会被记录在~/.log下root程序会被记录在/var/log下 |
| log | C | extern int kdk_logger_setdir(const char* dpath) | Set the log storage directory, if not set, non-root programs will be recorded in ~/.log, root programs will be recorded in /var/log |
| | | Parameter Description | Return value description | |
| | | dpath:日志存储路径 | int | 成功返回0失败返回-1 |
| | | dpath: log storage path | int | Returns 0 on success, -1 on failure |
> 设置日志输出自动换行
> Set log output to wrap automatically
| submodule | Programming language | statement | describe |
|-----|------|---------------------------------------------------|------------|
| 日志 | C | extern void kdk_logger_set_autowrap(int autowarp) | 设置日志输出自动换行 |
| log | C | extern void kdk_logger_set_autowrap(int autowarp) | Set log output to wrap automatically |
| | | Parameter Description | Return value description | |
| | | autowarp1表示启用启动换行0表示禁止自动换行 | 无 |
| | | autowarp1 means start line wrapping is enabled, 0 means automatic line wrapping is disabled | 无 |
## **5.2** 定时器
## **5.2** Timer
>
> C 语言定时器模块,给 C/C++程序提供定时器功能接口。
> C language timer module, providing timer function interface for C/C++ program.
```
@ -2646,7 +2646,7 @@ $ sudo apt-get install libkysdk-timer libkysdk-timer-dev
```
> 1CMakeLists.txt 构建项目
> 1CMakeLists.txt build project
>
```
aux_source_directory(. SOURCESCODE)
@ -2656,82 +2656,81 @@ target_link_libraries(kytimer pthread)
target_link_libraries(test-kytimer kytimer)
```
> 2调用定时器模块,需要添加头文件
> 2To call the timer module, you need to add a header file
>
```
#include "kysdk/kysdk-base/libkytimer.h"
```
>
> 初始化定时器
> Initialize timer
| submodule | Programming language | statement | describe |
|-----|------|----------------------|------------------|
| 定时器 | C | int kdk_timer_init() | 初始化定时器核心组件 |
| timer | C | int kdk_timer_init() | Initialize the timer core component |
| | | Parameter Description | Return value description | |
| | | 无 | int0表示成功非0表示失败 |
| | | 无 | int0 means success, non-zero means failure |
> 启动定时器
> start timer
| submodule | Programming language | statement | describe |
|-----|------|----------------------|------------------|
| 定时器 | C | size_t | kdk_timer_start(unsigned int intervalms, time_handler callback, KTimerAttribute attr, KTimerType type, void* userdata, int freeOnDelete) |
| timer | C | size_t | kdk_timer_start(unsigned int intervalms, time_handler callback, KTimerAttribute attr, KTimerType type, void* userdata, int freeOnDelete) |
| | | Parameter Description | Return value description |
| | | intervalms定时器时间,以毫秒为单位 | size_t定时器的ID |
| | | callback定时器到期后触发的回调函数指针 | |
| | | attr定时器属性KTIMER_SINGLESHOT表示一次性定时器KTIMER_PERIODIC表示周期性定时器KTIMER_NEVER表示不会被触发的定时器 | |
| | | type定时器类型KTIMER_ABSOLUTE表示绝对时间定时器修改系统时间不会影响定时器的时间KTIMER_RELATIVE表示相对时间定时器修改系统时间会影响定时器时间 | |
| | | userdata指向用户数据的指针 | |
| | | freeOnDelete [未启用] | |
| | | intervalmstimer time in milliseconds | The ID of the size_t timer |
| | | callbackThe callback function pointer triggered after the timer expires | |
| | | attrTimer attribute, KTIMER_SINGLESHOT indicates a one-time timer; KTIMER_PERIODIC indicates a periodic timer; KTIMER_NEVER indicates a timer that will not be triggered | |
| | | typeTimer type, KTIMER_ABSOLUTE indicates an absolute time timer, modifying the system time will not affect the timer time; KTIMER_RELATIVE indicates a relative time timer, modifying the system time will affect the timer time | |
| | | userdatapointer to user data | |
| | | freeOnDelete [Not Enabled] | |
> 停止给定的定时器
> stop the given timer
| submodule | Programming language | statement | describe |
|-----|------|-------------------------------------|----------|
| 定时器 | C | void kdk_timer_stop(size_t timerfd) | 停止给定的定时器 |
| timer | C | void kdk_timer_stop(size_t timerfd) | stop the given timer |
| | | Parameter Description | Return value description | |
| | | timerfd由kdk_timer_start返回的定时器ID | 无 |
| | | timerfdTimer ID returned by kdk_timer_start: | 无 |
> 销毁定时器
> destroy timer
| submodule | Programming language | statement | describe |
|-----|------|--------------------------|-------|
| 定时器 | C | void kdk_timer_destroy() | 销毁定时器 |
| timer | C | void kdk_timer_destroy() | destroy timer |
| | | Parameter Description | Return value description | |
| | | 无 | 无 |
> 重置定时器
> reset timer
| submodule | Programming language | statement | describe |
|-----|------|----------------------------------------------------------------|-------|
| 定时器 | C | void kdk_timer_reset(size_t timerfd , unsigned int intervalms) | 重置定时器 |
| timer | C | void kdk_timer_reset(size_t timerfd , unsigned int intervalms) | reset timer |
| | | Parameter Description | Return value description |
| | | timerfd由kdk_timer_start返回的定时器ID | 无 |
| | | intervalms需要调整的时间间隔以ms为单位 | |
| | | timerfdTimer ID returned by kdk_timer_start | 无 |
| | | intervalmsThe time interval that needs to be adjusted, in ms | |
## **5.3** C 语言字符串扩展
## **5.3** C language string extension
>
> 该模块封装了对字符串操作的 C 接口,包括字符串裁剪、分割、大小写转换、查找特定字符等操作。
> This module encapsulates the C interface for string operations, including string cropping, splitting, case conversion, and searching for specific characters.
```
$ sudo apt-get install libkysdk-utils libkysdk-utils-dev
```
> 1调用 C 语言字符串扩展模块,需要添加头文件
> 1To call the C language string extension module, a header file needs to be added
>
```
#include "kysdk/kysdk-base/cstring-extension.h"