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
31e5edbd
Commit
31e5edbd
authored
Jun 19, 2015
by
MrLee.Kun
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2 from astaxie/develop
pull from stable
parents
2af0c569
f7f390df
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
24 deletions
+33
-24
beego.go
beego.go
+2
-2
controller.go
controller.go
+1
-1
log.go
log.go
+5
-5
log.go
logs/log.go
+21
-15
router.go
router.go
+3
-0
staticfile.go
staticfile.go
+1
-1
No files found.
beego.go
View file @
31e5edbd
...
...
@@ -37,7 +37,7 @@ import (
)
// beego web framework version.
const
VERSION
=
"1.
4.3
"
const
VERSION
=
"1.
5.0
"
type
hookfunc
func
()
error
//hook function to run
var
hooks
[]
hookfunc
//hook function slice to store the hookfunc
...
...
@@ -336,7 +336,7 @@ func initBeforeHttpRun() {
// this function is for test package init
func
TestBeegoInit
(
apppath
string
)
{
AppPath
=
apppath
RunMode
=
"test"
os
.
Setenv
(
"BEEGO_RUNMODE"
,
"test"
)
AppConfigPath
=
filepath
.
Join
(
AppPath
,
"conf"
,
"app.conf"
)
err
:=
ParseConfig
()
if
err
!=
nil
&&
!
os
.
IsNotExist
(
err
)
{
...
...
controller.go
View file @
31e5edbd
...
...
@@ -527,7 +527,7 @@ func (c *Controller) GetFile(key string) (multipart.File, *multipart.FileHeader,
// }
// }
func
(
c
*
Controller
)
GetFiles
(
key
string
)
([]
*
multipart
.
FileHeader
,
error
)
{
files
,
ok
:=
c
.
Ctx
.
Request
.
MultipartForm
.
File
[
"key"
]
files
,
ok
:=
c
.
Ctx
.
Request
.
MultipartForm
.
File
[
key
]
if
ok
{
return
files
,
nil
}
...
...
log.go
View file @
31e5edbd
...
...
@@ -78,9 +78,9 @@ func Warning(v ...interface{}) {
BeeLogger
.
Warning
(
generateFmtStr
(
len
(
v
)),
v
...
)
}
//
Deprecated: compatibility alias for Warning(), Will be removed in 1.5.0.
//
compatibility alias for Warning()
func
Warn
(
v
...
interface
{})
{
Warning
(
v
...
)
BeeLogger
.
Warn
(
generateFmtStr
(
len
(
v
)),
v
...
)
}
func
Notice
(
v
...
interface
{})
{
...
...
@@ -92,9 +92,9 @@ func Informational(v ...interface{}) {
BeeLogger
.
Informational
(
generateFmtStr
(
len
(
v
)),
v
...
)
}
//
Deprecated: compatibility alias for Warning(), Will be removed in 1.5.0.
//
compatibility alias for Warning()
func
Info
(
v
...
interface
{})
{
Informational
(
v
...
)
BeeLogger
.
Info
(
generateFmtStr
(
len
(
v
)),
v
...
)
}
// Debug logs a message at debug level.
...
...
@@ -103,7 +103,7 @@ func Debug(v ...interface{}) {
}
// Trace logs a message at trace level.
//
Deprecated: compatibility alias for Warning(), Will be removed in 1.5.0.
//
compatibility alias for Warning()
func
Trace
(
v
...
interface
{})
{
BeeLogger
.
Trace
(
generateFmtStr
(
len
(
v
)),
v
...
)
}
...
...
logs/log.go
View file @
31e5edbd
...
...
@@ -157,18 +157,15 @@ func (bl *BeeLogger) writerMsg(loglevel int, msg string) error {
lm
.
level
=
loglevel
if
bl
.
enableFuncCallDepth
{
_
,
file
,
line
,
ok
:=
runtime
.
Caller
(
bl
.
loggerFuncCallDepth
)
if
_
,
filename
:=
path
.
Split
(
file
);
filename
==
"log.go"
&&
(
line
==
97
||
line
==
83
)
{
_
,
file
,
line
,
ok
=
runtime
.
Caller
(
bl
.
loggerFuncCallDepth
+
1
)
if
!
ok
{
file
=
"???"
line
=
0
}
if
ok
{
_
,
filename
:=
path
.
Split
(
file
)
lm
.
msg
=
fmt
.
Sprintf
(
"[%s:%d] %s"
,
filename
,
line
,
msg
)
}
else
{
lm
.
msg
=
msg
}
}
else
{
lm
.
msg
=
msg
}
if
bl
.
asynchronous
{
bl
.
msg
<-
lm
}
else
{
...
...
@@ -295,24 +292,33 @@ func (bl *BeeLogger) Debug(format string, v ...interface{}) {
}
// Log WARN level message.
//
// Deprecated: compatibility alias for Warning(), Will be removed in 1.5.0.
// compatibility alias for Warning()
func
(
bl
*
BeeLogger
)
Warn
(
format
string
,
v
...
interface
{})
{
bl
.
Warning
(
format
,
v
...
)
if
LevelWarning
>
bl
.
level
{
return
}
msg
:=
fmt
.
Sprintf
(
"[W] "
+
format
,
v
...
)
bl
.
writerMsg
(
LevelWarning
,
msg
)
}
// Log INFO level message.
//
// Deprecated: compatibility alias for Informational(), Will be removed in 1.5.0.
// compatibility alias for Informational()
func
(
bl
*
BeeLogger
)
Info
(
format
string
,
v
...
interface
{})
{
bl
.
Informational
(
format
,
v
...
)
if
LevelInformational
>
bl
.
level
{
return
}
msg
:=
fmt
.
Sprintf
(
"[I] "
+
format
,
v
...
)
bl
.
writerMsg
(
LevelInformational
,
msg
)
}
// Log TRACE level message.
//
// Deprecated: compatibility alias for Debug(), Will be removed in 1.5.0.
// compatibility alias for Debug()
func
(
bl
*
BeeLogger
)
Trace
(
format
string
,
v
...
interface
{})
{
bl
.
Debug
(
format
,
v
...
)
if
LevelDebug
>
bl
.
level
{
return
}
msg
:=
fmt
.
Sprintf
(
"[D] "
+
format
,
v
...
)
bl
.
writerMsg
(
LevelDebug
,
msg
)
}
// flush all chan data.
...
...
router.go
View file @
31e5edbd
...
...
@@ -611,6 +611,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
if
p
.
enableFilter
{
if
l
,
ok
:=
p
.
filters
[
pos
];
ok
{
for
_
,
filterR
:=
range
l
{
if
filterR
.
returnOnOutput
&&
w
.
started
{
return
true
}
if
ok
,
params
:=
filterR
.
ValidRouter
(
urlPath
);
ok
{
for
k
,
v
:=
range
params
{
context
.
Input
.
Params
[
k
]
=
v
...
...
staticfile.go
View file @
31e5edbd
...
...
@@ -58,7 +58,7 @@ func serverStaticRouter(ctx *context.Context) {
finfo
,
err
:=
os
.
Stat
(
file
)
if
err
!=
nil
{
if
RunMode
==
"dev"
{
Warn
(
err
)
Warn
(
"Can't find the file:"
,
file
,
err
)
}
http
.
NotFound
(
ctx
.
ResponseWriter
,
ctx
.
Request
)
return
...
...
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