Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
web_log
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bb08e140
authored
Dec 22, 2020
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
初始化可以监听全部内容
- 但是监听状态会被保存
parent
4da715ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
src/code/monitor.go
src/code/monitor.go
View file @
bb08e140
...
...
@@ -26,9 +26,21 @@ func monitor(filePath string) {
}
break
}
offset
:=
fileInfo
.
Size
()
//allready_msg := make([]byte, offset)
//初始监听时加载全部内容
allcontent_msg
:=
make
([]
byte
,
offset
)
allcontent_file
,
err
:=
os
.
Open
(
filePath
)
if
err
!=
nil
{
log
.
Printf
(
"[seelog] error:%v"
,
err
.
Error
())
}
_
,
err
=
allcontent_file
.
Read
(
allcontent_msg
)
if
err
!=
nil
{
log
.
Printf
(
"[seelog] error:%v"
,
err
.
Error
())
}
all_content
:=
filename
+
"$$"
+
string
(
allcontent_msg
)
manager
.
broadcast
<-
[]
byte
(
all_content
)
allcontent_file
.
Close
()
for
{
fileInfo
,
err
=
os
.
Stat
(
filePath
)
...
...
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