Comments (3)
I have tried adding the Init()
method in the log
package to specifically print the information in the init function, and defining a writer to control its output position. By controlling the writer, I can control the display of the log, such as the following solution:
Core/logs/log.go
var InitOut = NewLogger()
func Init(f interface{}, v ...interface{}) {
if InitOut != nil {
_, _ = fmt.Fprintf(beeLogger, formatPattern(f, v...), v...)
}
}
Core/config/ini.go
func init() {
Register("ini", &IniConfig{})
err := InitGlobalInstance("ini", "conf/app.conf")
if err != nil {
logs.Init("init global config instance failed. If you do not use this, just ignore it. ", err)
}
}
However, due to the inability to control the order in which the init function is executed, it cannot be guaranteed that modifications to InitOut
will always be executed before the init function in 'ini. go'. Therefore, this solution is also unable to control the display of the message.
from beego.
My beego version is v2.1.5
from beego.
This issue is inactive for a long time.
from beego.
Related Issues (20)
- A research for generating PR checklists in Pull Request Template HOT 2
- [Chore]: file name typo
- ORM logs to a custom file HOT 3
- ssl certificate expired HOT 2
- 建议此处的“Controller”增加可配置。可自由修改成其他字符
- Cannot ignore failure to load conf/app.conf because log writes to STDOUT HOT 2
- response 返回的时候自动对特殊字符转义了,如何禁止? HOT 4
- all requests from client got incorrect http headers, suddenly HOT 9
- Could not remove temporary file: remove m.exe HOT 1
- Custom RecoverFunc Always Executes Before ErrorController Methods
- 建议增加 SetConnMaxIdleTime HOT 1
- Website SSL Certificate Expired HOT 1
- 404/nomatch caused by routers/commentsRouter_controllers.go HOT 1
- Does beego/orm support single-batch transactions? HOT 2
- Using --graceful instead of -graceful since single hyphen is treaded as short version of a flag HOT 3
- 200 nomatch HOT 1
- How to set the keep alive message sending cycle for TCP HOT 2
- Session cookie sameSite property not keeped after SessionRegenerateID
- 为什么主页登陆不上去,从哪里能查询官方文档呢 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beego.