Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cs733
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sushant Mahajan
cs733
Commits
aafa7ab8
Commit
aafa7ab8
authored
Feb 10, 2015
by
Sushant Mahajan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allowed provision to disable debugging
parent
933059b0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
assignment2/src/server.go
assignment2/src/server.go
+7
-7
No files found.
assignment2/src/server.go
View file @
aafa7ab8
...
...
@@ -15,9 +15,6 @@ import (
// Logger
var
Info
*
log
.
Logger
// Flag for enabling/disabling logging functionality
var
DEBUG
=
true
var
rft
*
raft
.
Raft
type
AppendEntries
struct
{}
...
...
@@ -60,12 +57,11 @@ func initInterServerCommunication(server *raft.ServerConfig, rft *raft.Raft, ch
}
// Initialize Logger
func
initLogger
(
serverId
int
)
{
func
initLogger
(
serverId
int
,
toDebug
bool
)
{
// Logger Initializaion
if
!
DEBUG
{
if
!
toDebug
{
Info
=
log
.
New
(
ioutil
.
Discard
,
"INFO: "
,
log
.
Ldate
|
log
.
Ltime
|
log
.
Lshortfile
)
}
else
{
Info
=
log
.
New
(
os
.
Stdout
,
"INFO: "
,
log
.
Ldate
|
log
.
Ltime
|
log
.
Lshortfile
)
}
...
...
@@ -96,7 +92,11 @@ func main() {
Info
.
Println
(
"argument "
,
os
.
Args
[
1
],
"is not string"
)
}
initLogger
(
sid
)
if
len
(
os
.
Args
)
>
3
{
initLogger
(
sid
,
true
)
}
else
{
initLogger
(
sid
,
false
)
}
Info
.
Println
(
"Starting"
)
serverCount
,
err2
:=
strconv
.
Atoi
((
os
.
Args
[
2
]))
...
...
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