DaveWoodCom/XCGLogger — pull request #24 by hariseldon78 (2014-11-30 13:15:07+00:00)
Title: 1) added padding at console output; 2) added indentation capabilities for function calls logging. to log the execution of a function with correct indentation use the logFunc method to declare an instance of Indenter at the start of the function, for example:

func f()
{
let _lf=log.logFunc()
log.debug("hello")
[do stuff]
}
func g()
{
let _lf=log.logFunc()
f()
[do stuff]
}

the execution of g() will result in a log like this:

2014-11-30 12:35:53.275 [Debug] [file.swift:104] g : g(...) {
2014-11-30 12:35:53.276 [Debug] [file.swift:99] f : f(...) {
2014-11-30 12:35:53.277 [Debug] [file.swift:100] f : hello
2014-11-30 12:35:53.278 [Debug] [file.swift:99] f : }
2014-11-30 12:35:53.279 [Debug] [file.swift:104] g : }

vertical alignment; logging of functions, with indentation

Hello. I modified the XCGLogger library to add a vertical alignment (so it is easier to read) and to be able to log the which function calls witch. Here is one example of the results from my debug console (unedited!):

2014-11-30 12:35:53.274 [Debug] [Cerchio.swift:87] continueRotationAt :	continueRotationAt(...) {
2014-11-30 12:35:53.274 [Debug] [Cerchio.swift:131] rotateToAngle(_:withDuration:):	rotateToAngle(_:withDuration:)(...) {
2014-11-30 12:35:53.275 [Debug] [Cerchio.swift:132] rotateToAngle(_:withDuration:):	angle:-0.412985852003844π (-74.3374533606919°) duration:0.0
2014-11-30 12:35:53.275 [Debug] [Cerchio.swift:131] rotateToAngle(_:withDuration:):	}
2014-11-30 12:35:53.275 [Debug] [Cerchio.swift:87] continueRotationAt :	}
2014-11-30 12:35:53.275 [Debug] [Cerchio.swift:87] continueRotationAt :	continueRotationAt(...) {
2014-11-30 12:35:53.276 [Debug] [Cerchio.swift:131] rotateToAngle(_:withDuration:):	rotateToAngle(_:withDuration:)(...) {
2014-11-30 12:35:53.276 [Debug] [Cerchio.swift:132] rotateToAngle(_:withDuration:):	angle:-0.41375326170259π (-74.4755871064663°) duration:0.0
2014-11-30 12:35:53.276 [Debug] [Cerchio.swift:131] rotateToAngle(_:withDuration:):	}
2014-11-30 12:35:53.277 [Debug] [Cerchio.swift:87] continueRotationAt :	}
2014-11-30 12:35:53.341 [Debug] [Cerchio.swift:93] endRotationTo :	endRotationTo(...) {
2014-11-30 12:35:53.342 [Debug] [Cerchio.swift:87] continueRotationAt :	continueRotationAt(...) {
2014-11-30 12:35:53.342 [Debug] [Cerchio.swift:131] rotateToAngle(_:withDuration:):	rotateToAngle(_:withDuration:)(...) {
2014-11-30 12:35:53.342 [Debug] [Cerchio.swift:132] rotateToAngle(_:withDuration:):	angle:-0.41375326170259π (-74.4755871064663°) duration:0.0
2014-11-30 12:35:53.343 [Debug] [Cerchio.swift:131] rotateToAngle(_:withDuration:):	}
2014-11-30 12:35:53.343 [Debug] [Cerchio.swift:87] continueRotationAt :	}
2014-11-30 12:35:53.343 [Debug] [Cerchio.swift:131] rotateToAngle(_:withDuration:):	rotateToAngle(_:withDuration:)(...) {
2014-11-30 12:35:53.343 [Debug] [Cerchio.swift:132] rotateToAngle(_:withDuration:):	angle:-0.5π (-90.0°) duration:0.1
2014-11-30 12:35:53.344 [Debug] [Cerchio.swift:131] rotateToAngle(_:withDuration:):	}
2014-11-30 12:35:53.344 [Debug] [Cerchio.swift:93] endRotationTo :	}