Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
f05bb2ec
Commit
f05bb2ec
authored
Mar 28, 2016
by
JessonChan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function of beego/logs
parent
85a9b054
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
log.go
logs/log.go
+16
-3
No files found.
logs/log.go
View file @
f05bb2ec
...
...
@@ -152,13 +152,16 @@ func NewLogger(channelLens ...int64) *BeeLogger {
}
// Async set the log to asynchronous and start the goroutine
func
(
bl
*
BeeLogger
)
Async
()
*
BeeLogger
{
func
(
bl
*
BeeLogger
)
Async
(
msgLen
...
int64
)
*
BeeLogger
{
bl
.
lock
.
Lock
()
defer
bl
.
lock
.
Unlock
()
if
bl
.
asynchronous
{
return
bl
}
bl
.
asynchronous
=
true
if
len
(
msgLen
)
>
0
&&
msgLen
[
0
]
>
0
{
bl
.
msgChanLen
=
msgLen
[
0
]
}
bl
.
msgChan
=
make
(
chan
*
logMsg
,
bl
.
msgChanLen
)
logMsgPool
=
&
sync
.
Pool
{
New
:
func
()
interface
{}
{
...
...
@@ -515,8 +518,8 @@ func Reset() {
beeLogger
.
Reset
()
}
func
Async
()
*
BeeLogger
{
return
beeLogger
.
Async
()
func
Async
(
msgLen
...
int64
)
*
BeeLogger
{
return
beeLogger
.
Async
(
msgLen
...
)
}
// SetLevel sets the global log level used by the simple logger.
...
...
@@ -524,12 +527,22 @@ func SetLevel(l int) {
beeLogger
.
SetLevel
(
l
)
}
// EnableFuncCallDepth enable log funcCallDepth
func
EnableFuncCallDepth
(
b
bool
)
{
beeLogger
.
enableFuncCallDepth
=
b
}
// SetLogFuncCall set the CallDepth, default is 3
func
SetLogFuncCall
(
b
bool
)
{
beeLogger
.
EnableFuncCallDepth
(
b
)
beeLogger
.
SetLogFuncCallDepth
(
3
)
}
// SetLogFuncCallDepth set log funcCallDepth
func
SetLogFuncCallDepth
(
d
int
)
{
beeLogger
.
loggerFuncCallDepth
=
d
}
// SetLogger sets a new logger.
func
SetLogger
(
adapter
string
,
config
...
string
)
error
{
err
:=
beeLogger
.
SetLogger
(
adapter
,
config
...
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment