Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Parse and Link all log statements #9

Closed
yoiang opened this issue Nov 18, 2015 · 1 comment
Closed

Parse and Link all log statements #9

yoiang opened this issue Nov 18, 2015 · 1 comment

Comments

@yoiang
Copy link

yoiang commented Nov 18, 2015

Hey @julian-weinert , the project is such a neat / thisshouldalreadyexistApple / useful idea!

I apologize if this is out of the scope of the project but I was wondering if it would be difficult to extend the linking to all log statements, say any obvious [File name]:[Line number] match.

Considering how many log libraries are out there that people are tied to, especially libraries that by now are very extensive, it would be awesome if LinkedLog was agnostic to logging method you used, just so long as you matched an obvious pattern.

@julian-weinert
Copy link
Owner

You are right – this isn't an issue.
Please use the chat for discussions next time ;)

LinkedLog chat

Thanks for your feedback, btw

LinkedLog does parse everything that goes into the log.
This is also one reason it sometimes crashes Xcode.

This is the regular expression that is used to match the statements:
^[\d]{4}-[\d]{2}-[\d]{2}\s[\d]{2}:[\d]{2}:[\d]{2}.[\d]{3}\s[^\[]*\[\d*:\d*\]\s(.+\/([^\/:]+:\d+)):\s.*

It looks for sequences matching:

  • four numbers
  • dash
  • two numbers
  • dash
  • two numbers
  • whitespace
  • two numbers
  • colon
  • two numbers
  • colon
  • two numbers
  • period
  • three numbers
  • whitespace
  • everything but [
  • [
  • any numbers
  • colon
  • any numbers
  • ]
  • whitespace
  • one or more characters
  • slash followed by
    • more than one characters but slash and colon
    • colon
    • one or more numbers
  • colon
  • whitespace
  • any character

Example:
2015-11-04 17:53:48.045 myApp[9054:9026288] /Users/jw/Desktop/myApp/myApp/JFWAppDelegate.m:68: UIDeviceWhiteColorSpace 0.85 1
Prints as
2015-11-04 17:53:48.045 myApp[9054:9026288] JFWAppDelegate.m:68: UIDeviceWhiteColorSpace 0.85 1

Summarised, any log input that follows this format will be parsed by LinkedLog. This should be any log input that uses NSLog under its hood or at least NSLog's logging format (2015-11-04 17:53:48.045 myApp[9054:9026288]) in the beginning of the line followed by an absolute file path-colon-line number-colon-logstring.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants