安装导入

go get github.com/astaxie/beego/logs
import "github.com/astaxie/beego/logs"

使用

package main

import (
"encoding/json"
"fmt"
"github.com/astaxie/beego/logs"
) func main() {
config := make(map[string]interface{})
config["filename"] = "./logs/logcollect.log"
config["level"] = logs.LevelDebug configStr, err := json.Marshal(config)
if err != nil {
fmt.Println("marshal failed, err:", err)
return
} logs.SetLogger(logs.AdapterFile, string(configStr)) logs.Debug("this is a test, my name is %s", "stu01")
logs.Trace("this is a trace, my name is %s", "stu02")
logs.Warn("this is a warn, my name is %s", "stu03")
}

  

go logs的更多相关文章

  1. 微软发布TX(LINQ To Logs And Traces)

    微软开源技术公司于发布了Tx,这是一个Apache 2协议的开源项目,可以使用日志/跟踪文件辅助调试,以及创建实时监控和告警系统. 下面是几个引人关注的功能-- 允许在原始事件源上使用LINQ 允许在 ...

  2. CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

    今天,在用icinga服务器端测试客户端脚本时,报如下错误: [root@mysql-server1 etc]# /usr/local/icinga/libexec/check_nrpe -H 192 ...

  3. Android Gradle Build Error:Some file crunching failed, see logs for details解决办法

    转载请标明出处: http://www.cnblogs.com/why168888/p/5925756.html 本文出自:[Edwin博客园] 错误日志:Error:java.lang.Runtim ...

  4. MS SQL错误:SQL Server failed with error code 0xc0000000 to spawn a thread to process a new login or connection. Check the SQL Server error log and the Windows event logs for information about possible related problems

          早晨宁波那边的IT人员打电话告知数据库无法访问了.其实我在早晨也发现Ignite监控下的宁波的数据库服务器出现了异常,但是当时正在检查查看其它服务器发过来的各类邮件,还没等到我去确认具体情 ...

  5. 屏蔽zencart logs文件夹下不断生成的日志文件

    在根目錄下的logs文件夾中,經常生成一些錯誤文件類似myDEBUGxxxxx.log這樣的錯誤文件(而且這樣的錯誤文件由來并非網站出現什麽嚴重不可挽救的錯誤,大部分是一些未定義變量這樣的不起眼的小錯 ...

  6. Error:Execution failed for task ':app:mergeDebugResources'. > Some file crunching failed, see logs f

    今天调试安卓程序遇到的问题Error:Execution failed for task ':app:mergeDebugResources'. > Some file crunching fa ...

  7. (error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about t

    运行redis过程中,突然报错如下: (error) MISCONF Redis is configured to save RDB snapshots, but is currently not a ...

  8. System.Security.SecurityException The source was not found, but some or all event logs could not be searched.Inaccessible logs Security.

    An exception occurred during the Install phase. System.Security.SecurityException The source was not ...

  9. Android_bug之 task ':app:mergeDebugResources'. > Some file crunching failed, see logs f

    今天调试安卓程序遇到的问题Error:Execution failed for task ':app:mergeDebugResources'. > Some file crunching fa ...

  10. how to monitor system logs and export to files simultaneously

    What will you do when you conduct a malware analysis on a smartphone? You will focus on running proc ...

随机推荐

  1. int,String转换

    int -> String 第一种方法:s=i+""; //会产生两个String对象 第二种方法:s=String.valueOf(i); //直接使用String类的静态 ...

  2. Codeforces264 B. Good Sequences

    Codeforces题号:#264B 出处: Codeforces 主要算法:DP 难度:4.8 思路分析: 这题DP太难了…… 最终的解法是,令f[i]表示存在因子i的一个数作为子序列结尾的子序列的 ...

  3. Appium环境的安装以及一路上的坑

    Appium环境的安装以及一路上的坑 第一步环境的安装 l  javaJDK的安装以及环境变量的配置这个我就不说了网上的教程全都是,搜一个安装一下吧 l  AndroidSDK的安装也是如此我是直接安 ...

  4. WEB请求处理

    https://blog.csdn.net/bpingchang/article/details/51328941

  5. altera rom ram IP的浅层理解

    1.altera 提供了两种rom :单口rom和双口rom. 官方文档偷图: 单口rom:输出可以配置寄存器寄存再输出,时钟可以输入输出用不同的时钟. 双口rom:输入输出时钟可不同或者A与B的时钟 ...

  6. 解决sublime text3 中文字符乱码

    前言 由于系统编码问题导致的中文乱码解决,linux和windows解决方式都一样. 流程 linux下两步都需要,windows下只需要第二步. 1.在package install中搜索安装:co ...

  7. IDEA 不识别的MAVEN 项目应如何处理

    有些人啊,上传到git的项目,根本不是项目而是一个文件夹,文件夹里边还有个文件夹那才是项目,IDEA 不会识别出它是项目来 这个时候,需要选择这个文件夹下的pom.xml 文件 右键 pom.xml然 ...

  8. 【BZOJ 1701】Cow School(斜率优化/动态凸包/分治优化)

    原题题解和数据下载 Usaco2007 Jan 题意 小牛参加了n个测试,第i个测试满分是\(p_i\),它的得分是\(t_i\).老师去掉\(t_i/p_i\)最小的d个测试,将剩下的总得分/总满分 ...

  9. Django的Hello World

    Django安装 yum -y install python #安装python yum -y install epel-release #安装扩展源 yum -y install python-pi ...

  10. Hdoj 4540.威威猫系列故事——打地鼠 题解

    Problem Description 威威猫最近不务正业,每天沉迷于游戏"打地鼠". 每当朋友们劝他别太着迷游戏,应该好好工作的时候,他总是说,我是威威猫,猫打老鼠就是我的工作! ...