{"action":"created","comment":{"url":"https://api.github.com/repos/invenia/Memento.jl/pulls/comments/195830327","pull_request_review_id":129278138,"id":195830327,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NTgzMDMyNw==","diff_hunk":"@@ -26,49 +28,91 @@ Simply wraps the value `x` in a `Nullable` and sticks that in an `Attribute` wit\n empty `Function`.\n \"\"\"\n Attribute(x::T) where {T} = Attribute{T}(() -> x)\n+Attribute{T}(x::T) where {T} = Attribute{T}(() -> x)\n \n \"\"\"\n     get(attr::Attribute{T}) -> T\n \n Run set `attr.x` to the output of `attr.f` if `attr.x` is not already set.\n We then return the value stored in `attr.x`\n \"\"\"\n-function Base.get(attr::Attribute)\n+function Base.get(attr::Attribute{T}) where T\n     if isnull(attr.x)\n-        attr.x = Nullable(attr.f())\n+        attr.x = Nullable{T}(attr.f())\n     end\n \n-    return get(attr.x)\n+    return get(attr.x)::T\n end\n \n+hasfield(T::DataType, name::Symbol) = Base.fieldindex(T, name, false) > 0\n+\n \"\"\"\n     Record\n \n-Are an `Attribute` container used to store information about a log events including the\n-msg, date, level, stacktrace, etc. `Formatter`s use `Records` to format log\n+A dictionary-like container with `Symbol` keys used to store information about a log events\n+including the msg, date, level, stacktrace, etc. `Formatter`s use `Records` to format log\n message strings.\n \n-NOTE: you should access `Attribute`s in a `Record` by using `getindex` (ie: record[:msg])\n-as this will correctly extract the value from the `Attribute` container.\n+You can access the properties of a `Record` by using `getindex` (ie: record[:msg]).\n+\n+Subtypes of `Record` should implement `getindex(::MyRecord, ::Symbol)` and key-value pair\n+iteration.\n+\"\"\"\n+abstract type Record <: AbstractDict{Symbol, Any} end\n+\n \"\"\"\n-abstract type Record end\n+    AttributeRecord <: Record\n+\n+A `Record` which stores its properties as `Attribute`s for lazy evaluation.\n+\n+Calling `getindex` or iterating will evaluate and cache the properties accessed.\n+\n+Subtypes of `AttributeRecord` should implement `Memento.getattribute(::MyRecord, ::Symbol)`\n+instead of `getindex`.\n+\"\"\"\n+abstract type AttributeRecord <: Record end\n+\n+level(rec::Record) = rec[:level]\n+Base.getindex(rec::Record, attr::Symbol) = getfield(rec, attr)\n+Base.haskey(rec::Record, attr::Symbol) = hasfield(rec, attr)\n+Base.keys(rec::T) where {T <: Record} = (fieldname(T, i) for i in 1:nfields(rec))\n+\n+Base.start(rec::Record) = 0\n+Base.done(rec::T, state) where {T <: Record} = state >= nfields(T)\n+\n+function Base.next(rec::T, state::Int) where T <: Record\n+    new_state = state + 1\n+    return (fieldname(T, new_state) => getfield(rec, new_state), new_state)\n+end\n+\n+function Base.next(rec::T, state::Int) where T <: AttributeRecord\n+    new_state = state + 1\n+    return (fieldname(T, new_state) => get(getfield(rec, new_state)), new_state)\n+end\n+\n+\"\"\"\n+    getattribute(rec::AttributeRecord, attr::Symbol)\n+\"\"\"\n+getattribute(rec::AttributeRecord, attr::Symbol) = getfield(rec, attr)","path":"src/records.jl","position":91,"original_position":92,"commit_id":"3e3e2737de06072b901c7b6b94dc06ccb38e01db","original_commit_id":"3afc5ee1a744d22bc977466bafccd0f4fdb9c406","user":{"login":"rofinn","id":5276097,"node_id":"MDQ6VXNlcjUyNzYwOTc=","avatar_url":"https://avatars2.githubusercontent.com/u/5276097?v=4","gravatar_id":"","url":"https://api.github.com/users/rofinn","html_url":"https://github.com/rofinn","followers_url":"https://api.github.com/users/rofinn/followers","following_url":"https://api.github.com/users/rofinn/following{/other_user}","gists_url":"https://api.github.com/users/rofinn/gists{/gist_id}","starred_url":"https://api.github.com/users/rofinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rofinn/subscriptions","organizations_url":"https://api.github.com/users/rofinn/orgs","repos_url":"https://api.github.com/users/rofinn/repos","events_url":"https://api.github.com/users/rofinn/events{/privacy}","received_events_url":"https://api.github.com/users/rofinn/received_events","type":"User","site_admin":false},"body":"Yeah, I'd be in favour of using `getproperty` once Memento is 0.7 only. I'm still not a fan of `getproperty` overloading, but it seems like that'll be a common julia convention going forward.","created_at":"2018-06-15T18:39:48Z","updated_at":"2018-06-15T18:39:48Z","html_url":"https://github.com/invenia/Memento.jl/pull/86#discussion_r195830327","pull_request_url":"https://api.github.com/repos/invenia/Memento.jl/pulls/86","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/invenia/Memento.jl/pulls/comments/195830327"},"html":{"href":"https://github.com/invenia/Memento.jl/pull/86#discussion_r195830327"},"pull_request":{"href":"https://api.github.com/repos/invenia/Memento.jl/pulls/86"}},"in_reply_to_id":195262795},"pull_request":{"url":"https://api.github.com/repos/invenia/Memento.jl/pulls/86","id":194732236,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0NzMyMjM2","html_url":"https://github.com/invenia/Memento.jl/pull/86","diff_url":"https://github.com/invenia/Memento.jl/pull/86.diff","patch_url":"https://github.com/invenia/Memento.jl/pull/86.patch","issue_url":"https://api.github.com/repos/invenia/Memento.jl/issues/86","number":86,"state":"open","locked":false,"title":"Make records more dict-like and update docs","user":{"login":"iamed2","id":3131001,"node_id":"MDQ6VXNlcjMxMzEwMDE=","avatar_url":"https://avatars3.githubusercontent.com/u/3131001?v=4","gravatar_id":"","url":"https://api.github.com/users/iamed2","html_url":"https://github.com/iamed2","followers_url":"https://api.github.com/users/iamed2/followers","following_url":"https://api.github.com/users/iamed2/following{/other_user}","gists_url":"https://api.github.com/users/iamed2/gists{/gist_id}","starred_url":"https://api.github.com/users/iamed2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamed2/subscriptions","organizations_url":"https://api.github.com/users/iamed2/orgs","repos_url":"https://api.github.com/users/iamed2/repos","events_url":"https://api.github.com/users/iamed2/events{/privacy}","received_events_url":"https://api.github.com/users/iamed2/received_events","type":"User","site_admin":false},"body":"Check out https://github.com/invenia/Memento.jl/compare/master...ed/dicty-records#diff-1cf5ee78db9c942d5f54f4cd2c123b37 for a description of what Records look like now. The simplest way to extend should be to define a subtype of Record/AttributeRecord with different fields. \r\n\r\nTODO: decide what a Record's constructor should be and deal with level/levelnum\r\n\r\n@ararslan: I may have fucked up the `Attribute` constructors on 0.7, let me know if that's the case","created_at":"2018-06-13T22:24:50Z","updated_at":"2018-06-15T18:39:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8a9239155731a72fba3d05ec7613ef2287a1dd0b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/invenia/Memento.jl/pulls/86/commits","review_comments_url":"https://api.github.com/repos/invenia/Memento.jl/pulls/86/comments","review_comment_url":"https://api.github.com/repos/invenia/Memento.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/invenia/Memento.jl/issues/86/comments","statuses_url":"https://api.github.com/repos/invenia/Memento.jl/statuses/3e3e2737de06072b901c7b6b94dc06ccb38e01db","head":{"label":"invenia:ed/dicty-records","ref":"ed/dicty-records","sha":"3e3e2737de06072b901c7b6b94dc06ccb38e01db","user":{"login":"invenia","id":5262440,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNjI0NDA=","avatar_url":"https://avatars2.githubusercontent.com/u/5262440?v=4","gravatar_id":"","url":"https://api.github.com/users/invenia","html_url":"https://github.com/invenia","followers_url":"https://api.github.com/users/invenia/followers","following_url":"https://api.github.com/users/invenia/following{/other_user}","gists_url":"https://api.github.com/users/invenia/gists{/gist_id}","starred_url":"https://api.github.com/users/invenia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/invenia/subscriptions","organizations_url":"https://api.github.com/users/invenia/orgs","repos_url":"https://api.github.com/users/invenia/repos","events_url":"https://api.github.com/users/invenia/events{/privacy}","received_events_url":"https://api.github.com/users/invenia/received_events","type":"Organization","site_admin":false},"repo":{"id":77126819,"node_id":"MDEwOlJlcG9zaXRvcnk3NzEyNjgxOQ==","name":"Memento.jl","full_name":"invenia/Memento.jl","owner":{"login":"invenia","id":5262440,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNjI0NDA=","avatar_url":"https://avatars2.githubusercontent.com/u/5262440?v=4","gravatar_id":"","url":"https://api.github.com/users/invenia","html_url":"https://github.com/invenia","followers_url":"https://api.github.com/users/invenia/followers","following_url":"https://api.github.com/users/invenia/following{/other_user}","gists_url":"https://api.github.com/users/invenia/gists{/gist_id}","starred_url":"https://api.github.com/users/invenia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/invenia/subscriptions","organizations_url":"https://api.github.com/users/invenia/orgs","repos_url":"https://api.github.com/users/invenia/repos","events_url":"https://api.github.com/users/invenia/events{/privacy}","received_events_url":"https://api.github.com/users/invenia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/invenia/Memento.jl","description":"A flexible logging library for Julia","fork":false,"url":"https://api.github.com/repos/invenia/Memento.jl","forks_url":"https://api.github.com/repos/invenia/Memento.jl/forks","keys_url":"https://api.github.com/repos/invenia/Memento.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/invenia/Memento.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/invenia/Memento.jl/teams","hooks_url":"https://api.github.com/repos/invenia/Memento.jl/hooks","issue_events_url":"https://api.github.com/repos/invenia/Memento.jl/issues/events{/number}","events_url":"https://api.github.com/repos/invenia/Memento.jl/events","assignees_url":"https://api.github.com/repos/invenia/Memento.jl/assignees{/user}","branches_url":"https://api.github.com/repos/invenia/Memento.jl/branches{/branch}","tags_url":"https://api.github.com/repos/invenia/Memento.jl/tags","blobs_url":"https://api.github.com/repos/invenia/Memento.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/invenia/Memento.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/invenia/Memento.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/invenia/Memento.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/invenia/Memento.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/invenia/Memento.jl/languages","stargazers_url":"https://api.github.com/repos/invenia/Memento.jl/stargazers","contributors_url":"https://api.github.com/repos/invenia/Memento.jl/contributors","subscribers_url":"https://api.github.com/repos/invenia/Memento.jl/subscribers","subscription_url":"https://api.github.com/repos/invenia/Memento.jl/subscription","commits_url":"https://api.github.com/repos/invenia/Memento.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/invenia/Memento.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/invenia/Memento.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/invenia/Memento.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/invenia/Memento.jl/contents/{+path}","compare_url":"https://api.github.com/repos/invenia/Memento.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/invenia/Memento.jl/merges","archive_url":"https://api.github.com/repos/invenia/Memento.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/invenia/Memento.jl/downloads","issues_url":"https://api.github.com/repos/invenia/Memento.jl/issues{/number}","pulls_url":"https://api.github.com/repos/invenia/Memento.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/invenia/Memento.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/invenia/Memento.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/invenia/Memento.jl/labels{/name}","releases_url":"https://api.github.com/repos/invenia/Memento.jl/releases{/id}","deployments_url":"https://api.github.com/repos/invenia/Memento.jl/deployments","created_at":"2016-12-22T08:26:37Z","updated_at":"2018-06-13T16:36:29Z","pushed_at":"2018-06-14T19:25:02Z","git_url":"git://github.com/invenia/Memento.jl.git","ssh_url":"git@github.com:invenia/Memento.jl.git","clone_url":"https://github.com/invenia/Memento.jl.git","svn_url":"https://github.com/invenia/Memento.jl","homepage":"https://invenia.github.io/Memento.jl/latest","size":632,"stargazers_count":25,"watchers_count":25,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":9,"open_issues":10,"watchers":25,"default_branch":"master"}},"base":{"label":"invenia:master","ref":"master","sha":"523644d50dedf66f80f974d1f6d5269fb000f212","user":{"login":"invenia","id":5262440,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNjI0NDA=","avatar_url":"https://avatars2.githubusercontent.com/u/5262440?v=4","gravatar_id":"","url":"https://api.github.com/users/invenia","html_url":"https://github.com/invenia","followers_url":"https://api.github.com/users/invenia/followers","following_url":"https://api.github.com/users/invenia/following{/other_user}","gists_url":"https://api.github.com/users/invenia/gists{/gist_id}","starred_url":"https://api.github.com/users/invenia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/invenia/subscriptions","organizations_url":"https://api.github.com/users/invenia/orgs","repos_url":"https://api.github.com/users/invenia/repos","events_url":"https://api.github.com/users/invenia/events{/privacy}","received_events_url":"https://api.github.com/users/invenia/received_events","type":"Organization","site_admin":false},"repo":{"id":77126819,"node_id":"MDEwOlJlcG9zaXRvcnk3NzEyNjgxOQ==","name":"Memento.jl","full_name":"invenia/Memento.jl","owner":{"login":"invenia","id":5262440,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNjI0NDA=","avatar_url":"https://avatars2.githubusercontent.com/u/5262440?v=4","gravatar_id":"","url":"https://api.github.com/users/invenia","html_url":"https://github.com/invenia","followers_url":"https://api.github.com/users/invenia/followers","following_url":"https://api.github.com/users/invenia/following{/other_user}","gists_url":"https://api.github.com/users/invenia/gists{/gist_id}","starred_url":"https://api.github.com/users/invenia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/invenia/subscriptions","organizations_url":"https://api.github.com/users/invenia/orgs","repos_url":"https://api.github.com/users/invenia/repos","events_url":"https://api.github.com/users/invenia/events{/privacy}","received_events_url":"https://api.github.com/users/invenia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/invenia/Memento.jl","description":"A flexible logging library for Julia","fork":false,"url":"https://api.github.com/repos/invenia/Memento.jl","forks_url":"https://api.github.com/repos/invenia/Memento.jl/forks","keys_url":"https://api.github.com/repos/invenia/Memento.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/invenia/Memento.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/invenia/Memento.jl/teams","hooks_url":"https://api.github.com/repos/invenia/Memento.jl/hooks","issue_events_url":"https://api.github.com/repos/invenia/Memento.jl/issues/events{/number}","events_url":"https://api.github.com/repos/invenia/Memento.jl/events","assignees_url":"https://api.github.com/repos/invenia/Memento.jl/assignees{/user}","branches_url":"https://api.github.com/repos/invenia/Memento.jl/branches{/branch}","tags_url":"https://api.github.com/repos/invenia/Memento.jl/tags","blobs_url":"https://api.github.com/repos/invenia/Memento.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/invenia/Memento.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/invenia/Memento.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/invenia/Memento.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/invenia/Memento.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/invenia/Memento.jl/languages","stargazers_url":"https://api.github.com/repos/invenia/Memento.jl/stargazers","contributors_url":"https://api.github.com/repos/invenia/Memento.jl/contributors","subscribers_url":"https://api.github.com/repos/invenia/Memento.jl/subscribers","subscription_url":"https://api.github.com/repos/invenia/Memento.jl/subscription","commits_url":"https://api.github.com/repos/invenia/Memento.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/invenia/Memento.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/invenia/Memento.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/invenia/Memento.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/invenia/Memento.jl/contents/{+path}","compare_url":"https://api.github.com/repos/invenia/Memento.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/invenia/Memento.jl/merges","archive_url":"https://api.github.com/repos/invenia/Memento.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/invenia/Memento.jl/downloads","issues_url":"https://api.github.com/repos/invenia/Memento.jl/issues{/number}","pulls_url":"https://api.github.com/repos/invenia/Memento.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/invenia/Memento.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/invenia/Memento.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/invenia/Memento.jl/labels{/name}","releases_url":"https://api.github.com/repos/invenia/Memento.jl/releases{/id}","deployments_url":"https://api.github.com/repos/invenia/Memento.jl/deployments","created_at":"2016-12-22T08:26:37Z","updated_at":"2018-06-13T16:36:29Z","pushed_at":"2018-06-14T19:25:02Z","git_url":"git://github.com/invenia/Memento.jl.git","ssh_url":"git@github.com:invenia/Memento.jl.git","clone_url":"https://github.com/invenia/Memento.jl.git","svn_url":"https://github.com/invenia/Memento.jl","homepage":"https://invenia.github.io/Memento.jl/latest","size":632,"stargazers_count":25,"watchers_count":25,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":9,"open_issues":10,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/invenia/Memento.jl/pulls/86"},"html":{"href":"https://github.com/invenia/Memento.jl/pull/86"},"issue":{"href":"https://api.github.com/repos/invenia/Memento.jl/issues/86"},"comments":{"href":"https://api.github.com/repos/invenia/Memento.jl/issues/86/comments"},"review_comments":{"href":"https://api.github.com/repos/invenia/Memento.jl/pulls/86/comments"},"review_comment":{"href":"https://api.github.com/repos/invenia/Memento.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/invenia/Memento.jl/pulls/86/commits"},"statuses":{"href":"https://api.github.com/repos/invenia/Memento.jl/statuses/3e3e2737de06072b901c7b6b94dc06ccb38e01db"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"rofinn"}}