-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split logs into multiple files #142
Comments
I'm considering stealing this issue, but I'm thinking if we should maybe use CocoaLumberJack for logging then? It has this functionality built in + logging to different places, nice colors etc. I could migrate everything to that. What do you think? |
Sounds good - currently we're using a tiny class I wrote in BuildaUtils for this. I'm not positive we need to bring in a large dependency like Lumberjack yet. So if you could take a look at the state of it and evaluate what additional feature we'd get, that would definitely be super helpful. Yes, the splitting of log files is nice, but we can write that ourselves easily. So again, I'm happy to bring in CL as long as there are enough benefits. |
I have looked a bit at it. The health of the project is very good, with many contributors and is being used in a a lot of other projects. However, the Swift 2.0 support is currently in beta, but since it's a pretty small project I image there isn't much that will go wrong. The pros of CocoaLumberjack for Buildasaur (in my opinion):
Also there's colored console output, which is mostly just because I personally like when it's easy to distinguish warns/errors from info output 😄 not really required for Buildasaur. The cons:
In the end, It's up to you to choose. I can't argue that CL is needed. It's a fun project for sure but definitely not revolutionary for Buildasaur. |
Okay, go for it and replace the guts of the current Log class in Thanks for taking the time!
|
I have now implemented this at https://github.com/accatyyc/Buildasaur/tree/lumberjack. In my opinion there's not much value in proxying through the current log system, since it was already 99% similar to CocoaLumberjack. The result is that all that remains is this: public class Log {
public class func verbose(message: String) {
DDLogVerbose(message)
}
public class func info(message: String) {
DDLogInfo(message)
}
public class func error(error: ErrorType) {
self.error("\(error)")
}
public class func error(message: String) {
DDLogError(message)
}
public class func untouched(message: String) {
DDLogInfo(message)
}
} It should probably contain a function here for |
Yeah I've used CL before, so I modeled the API very similarly on purpose. But the reason why I really like proxying through the current class is that we don't need to
|
Also, this is the class where you should plug in CocoaLumberjack. It needs to live in The class you changed just sets up the Let me know if you need any help with this 👍 |
Yeah, it's the class I changed :) I also just changed the classes names during setup in that other place. I can add back the previous subclasses if you want but they didn't need any methods so it felt unnecessary. |
Oh wait, never mind that. Didn't realise there were two of the same. Will take a look at it! |
Yeah there are two classes with the same name, sorry. |
Hey @accatyyc, have you ever finished this one? :) |
Actually, I have totally forgotten about it 😄 It shouldn't be much work to finish it if you've decided that the Lumberjack-dependency is OK. Any other thoughts than the previous discussion? |
Well, I'd prefer if we could just re-implement the bit that splits the log files when they get large. I would prefer to NOT pull in the whole CL project, because it will be a dependency of BuildaUtils, which is also a dep for XcodeServerSDK. Maybe we could just look at how CL does it and use a simplified version. |
Ok! I can take a look at a simple file-split implementation! |
👍 Thanks. I don't want people to end up with multi-GB log files and then be mad 😊 |
Implemented in buildasaurs/BuildaUtils#11 |
Once I merge the PR in BuildaUtils, I'll release a new version right away so that you can finish up the integration in Buildasaur. 👍 |
@accatyyc ok, I released https://github.com/czechboy0/BuildaUtils/releases/tag/v0.2.5 , so feel free to update it here in Buildasaur and integrate with the defaults we talked about. |
Right now logs keep getting appended to one file, which grows to GBs. We need to automatically split into a new file when we go over certain size.
The text was updated successfully, but these errors were encountered: