_Core/Lang/Plugins/Parser/LogPlugin.cs

(开头部分) 15KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using ComLib.Lang;
using ComLib.Lang.Helpers;

namespace ComLib.Lang.Extensions
{

    /* *************************************************************************
    <doc:example>
    
    // CONFIGURATION    
    // 1. Set level to "error" and log to console
    log.configure( 'error', 'console' )
    
    // 2. Fluen mode, set level = "error" and log to console.
    log configure 'error', 'console'
    
    // 3. File logging: set level to "warn" and log to file
    log configure 'warn', 'c:/temp/myapp.log'
    
    // 4. File logging: set level to "warn" and log to file with a name format.
    // log file name will be converted to "myapp-2012-07-15-time-09-45-12.log"
    log configure 'warn', 'c:/temp/myapp.log', '${yyyy-MM-dd}-time-${HH-mm-ss}'
    
    // 5. Get the current log level : this is only a getter property
    print( log.level )
    
    
    // LOGGING   
    // 1. Using OO ( object oriented ) syntax e.g. "log.<method>"
    log.error( 'an error occurred' )
    
    // 2. Using OO syntax with formatting
    log.warn( 'could not load {0}', 'blogs' )
    
    // 3. Using OO syntax in fluent mode
    log info 'finished updating data'
    
    // 4. functional mode - without prefixing with "log."
    error 'unable to initialize'
    warn 'could not send notification'
    info 'finished updating data'
    
    // NOTES: Log-level
    // 1. fatal
    // 2. error
    // 3. warn
    // 4. info
    // 5. debug
    // 6. put   ( this will always output the log message )    
    </doc:example>
    ***************************************************************************/
    /// <summary>
    /// Constants used for the log plugin
    /// </summary>
    public class LogPluginConstants
后面还有 416 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。