Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
9c5ceb70
authored
2014-04-02 23:43:37 +0800
by
asta.xie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Logs: modify StartLogger to private
1 parent
bf0b1af6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
logs/file.go
logs/log.go
logs/file.go
View file @
9c5ceb7
...
...
@@ -97,12 +97,12 @@ func (w *FileLogWriter) Init(jsonconfig string) error {
if
len
(
w
.
Filename
)
==
0
{
return
errors
.
New
(
"jsonconfig must have filename"
)
}
err
=
w
.
S
tartLogger
()
err
=
w
.
s
tartLogger
()
return
err
}
// start file logger. create log file and set to locker-inside file writer.
func
(
w
*
FileLogWriter
)
S
tartLogger
()
error
{
func
(
w
*
FileLogWriter
)
s
tartLogger
()
error
{
fd
,
err
:=
w
.
createLogFile
()
if
err
!=
nil
{
return
err
...
...
@@ -199,7 +199,7 @@ func (w *FileLogWriter) DoRotate() error {
}
// re-start logger
err
=
w
.
S
tartLogger
()
err
=
w
.
s
tartLogger
()
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Rotate StartLogger: %s
\n
"
,
err
)
}
...
...
logs/log.go
View file @
9c5ceb7
...
...
@@ -67,7 +67,7 @@ func NewLogger(channellen int64) *BeeLogger {
bl
.
msg
=
make
(
chan
*
logMsg
,
channellen
)
bl
.
outputs
=
make
(
map
[
string
]
LoggerInterface
)
//bl.SetLogger("console", "") // default output to console
go
bl
.
S
tartLogger
()
go
bl
.
s
tartLogger
()
return
bl
}
...
...
@@ -78,7 +78,10 @@ func (bl *BeeLogger) SetLogger(adaptername string, config string) error {
defer
bl
.
lock
.
Unlock
()
if
log
,
ok
:=
adapters
[
adaptername
];
ok
{
lg
:=
log
()
lg
.
Init
(
config
)
err
:=
lg
.
Init
(
config
)
if
err
!=
nil
{
return
err
}
bl
.
outputs
[
adaptername
]
=
lg
return
nil
}
else
{
...
...
@@ -138,7 +141,7 @@ func (bl *BeeLogger) EnableFuncCallDepth(b bool) {
// start logger chan reading.
// when chan is full, write logs.
func
(
bl
*
BeeLogger
)
S
tartLogger
()
{
func
(
bl
*
BeeLogger
)
s
tartLogger
()
{
for
{
select
{
case
bm
:=
<-
bl
.
msg
:
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment