Skip to content

Latest commit

ย 

History

History
772 lines (650 loc) ยท 31.5 KB

README.old.md

File metadata and controls

772 lines (650 loc) ยท 31.5 KB

Title: ๋กœ๊ทธ ํ‘œ์ค€ํ™”์™€ LogLab Author: Jeong Ju Kim

๋กœ๊ทธ ํ‘œ์ค€ํ™”์˜ ๊ณผ์ œ์™€ ๋ฐฉํ–ฅ

๋กœ๊ทธ ํ‘œ์ค€ํ™”๋ž€? ๋กœ๊ทธ ํ‘œ์ค€ํ™”๋Š” ํšŒ์‚ฌ๋‚˜ ์กฐ์ง์—์„œ ๋กœ๊ทธ์˜ ์ˆ˜์ง‘, ๋ถ„์„, ํ™œ์šฉ์— ์šฉ์ดํ•˜๋„๋ก ์„œ๋กœ ๋‹ค๋ฅธ ์„œ๋น„์Šค๊ฐ„ ๋กœ๊ทธ์˜ ํ˜•์‹์„ ์ผ๊ด€์„ฑ์žˆ๊ฒŒ ํ•˜๊ณ , ํ–ฅํ›„์˜ ๋ณ€๊ฒฝ ๋ฐ ์ถ”๊ฐ€ ์ž‘์—…๋„ ์˜ˆ์ธก ๊ฐ€๋Šฅํ•œ ๋ฐฉ์‹์„ ๋”ฐ๋ฅด๋„๋ก ํ•˜์—ฌ ๊ด€๋ จ ๋ฆฌ์†Œ์Šค ์ตœ์ ํ™”์™€ ๋ฐ์ดํ„ฐ์˜ ๊ฐ€์น˜๋ฅผ ๋†’์ด๋ ค๋Š” ํ™œ๋™์„ ๋งํ•œ๋‹ค.

๋กœ๊ทธ ํ‘œ์ค€ํ™”๋Š” ๋‹จ์ˆœํžˆ ํ•œ ์ฐจ๋ก€๋กœ ์ œ์ •์œผ๋กœ ๋๋‚˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, ์ง€์†์ ์ธ ์˜๊ฒฌ ์ˆ˜๋ ด, ๊ฐœ์„  ๊ทธ๋ฆฌ๊ณ  ํ™œ์šฉ์„ ํ†ตํ•ด ๊ด€๊ณ„์ž๋“ค์ด ํ•จ๊ป˜ ๋งŒ๋“ค์–ด ๋‚˜๊ฐ€๋Š” ํ™œ๋™์ด๋‹ค.

๋กœ๊ทธ ํ‘œ์ค€ํ™” ์œ„์›ํšŒ ๋กœ๊ทธ ํ‘œ์ค€ํ™”๋Š” ํ•œ ๋‘ ์‚ฌ๋žŒ์˜ ํž˜์œผ๋กœ ๋‹จ๊ธฐ๊ฐ„์— ์ด๋ฃจ์–ด ์งˆ ์ˆ˜ ์—†๊ธฐ์—, ๋กœ๊ทธ ํ‘œ์ค€ํ™”๋ฅผ ์œ„ํ•œ ์œ„์›ํšŒ๋ฅผ ์ œ์•ˆํ•œ๋‹ค. ์œ„์›ํšŒ๋Š” ์‚ฌ๋‚ด์˜ ๋‹ค์–‘ํ•œ ๋ถ„์•ผ์—์„œ ๋กœ๊ทธ ๊ด€๋ จ ์—…๋ฌด๋ฅผ ๋งก๊ณ  ์žˆ๋Š” ๋‹ด๋‹น์ž๋“ค๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ผ์„ ์ˆ˜ํ–‰ํ•œ๋‹ค.

  • ๋กœ๊ทธ ํ‘œ์ค€์•ˆ ํ˜‘์˜
  • ๋กœ๊ทธ ํ‘œ์ค€ ๋ช…์„ธ ์ž‘์„ฑ
  • ๋กœ๊ทธ ํ‘œ์ค€ํ™” ๊ด€๋ จ ํˆด์˜ ๊ฐœ๋ฐœ
  • ๋กœ๊ทธ ํ‘œ์ค€ ์ „ํŒŒ ๋ฐ ์„œ๋น„์Šค ๋ณ„ ๋‹ด๋‹น์ž์™€ ์ปค๋ฎค๋‹ˆ์ผ€์ด์…˜
  • ๊ฐœ์„ ์•ˆ ๋ฐ˜์˜

ํ‘œ์ค€์˜ ๋‹ค์–‘ํ•œ ํ•„์š”์„ฑ ๋กœ๊ทธ ํ‘œ์ค€ํ™”์˜ ๋ชฉ์ ์— ๋™์˜ํ•˜๋Š” ๊ฒƒ์€ ์–ด๋ ต์ง€ ์•Š์œผ๋‚˜, ์กฐ์ง ๊ตฌ์„ฑ์› ๊ฐ์ž์˜ ์—ญํ•  ๋ฐ ์ž…์žฅ์—์„œ ๋ฐ”๋ผ๋ณธ ๋กœ๊ทธ ํ‘œ์ค€ํ™”๋Š” ๋‹ค์–‘ํ•œ ํ•„์š”์„ฑ์„ ๊ฐ€์ง„๋‹ค.

์„œ๋น„์Šค ๊ฐœ๋ฐœ์ž

  • ์ฝ”๋”ฉ์— ์ฐธ๊ณ ํ•  ์ˆ˜ ์žˆ๋Š” ๋กœ๊ทธ ๋ฌธ์„œ๋ฅผ ์ œ๊ณตํ•˜๋Š”๊ฐ€?
  • ํ‘œ์ค€์„ ๋”ฐ๋ฅด๋˜, ํ•„์š”์— ๋”ฐ๋ผ ๋กœ๊ทธ์˜ ์ถ”๊ฐ€/๋ณ€๊ฒฝ์ด ์šฉ์ดํ•œ๊ฐ€?
  • ๋‚ด๊ฐ€ ์ƒ์„ฑํ•œ ๋กœ๊ทธ๊ฐ€ ํ‘œ์ค€์„ ๋งŒ์กฑํ•˜๋Š”์ง€ ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์žˆ๋Š”๊ฐ€?
  • ๊ฐœ๋ฐœ ์–ธ์–ด์—์„œ ์‰ฝ๊ฒŒ ์“ธ ์ˆ˜ ์žˆ๋Š” ๋กœ๊ทธ ๊ฐ์ฒด๋‚˜ ์ถœ๋ ฅ๊ธฐ๋ฅผ ์ œ๊ณตํ•˜๋Š”๊ฐ€?

์‹œ์Šคํ…œ ์—”์ง€๋‹ˆ์–ด

  • ๋ฐฐํฌ๋‚˜ ์„œ๋ฒ„ ์ฆ/๊ฐ์„ค์— ์šฉ์ดํ•œ ๊ตฌ์กฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š”๊ฐ€?
  • ๋กœ๊ทธ ์ถœ๋ ฅ ๋ฏธ๋””์–ด๊ฐ€ ์„ค์น˜ ๋ฐ ์šด์˜์— ์šฉ์ดํ•œ๊ฐ€?

๋ฐ์ดํ„ฐ ์—”์ง€๋‹ˆ์–ด

  • ๋กœ๊ทธ์˜ ์ถœ๋ ฅ ๋Œ€์ƒ์ด ์ ์ ˆํ•œ ๋ฏธ๋””์–ด(ํŒŒ์ผ, RDB, ํ•˜๋‘ก ๋“ฑ)๋กœ ๊ฐ€๋Šฅํ•œ๊ฐ€?
  • ๋กœ๊ทธ ์ˆ˜์ง‘/์ •๋ฆฌ์— ํ•„์š”ํ•œ ๋ฌธ์„œ ๋ฐ ์ƒ˜ํ”Œ์„ ์ œ๊ณตํ•˜๋Š”๊ฐ€?
  • ๋กœ๊ทธ ๊ตฌ์กฐ ๋ณ€๊ฒฝ์‹œ ๋ฒ„์ „ ๊ด€๋ฆฌ๊ฐ€ ์šฉ์ดํ•œ๊ฐ€?

๋ถ„์„/๋ฐ์ดํ„ฐ ๊ณผํ•™์ž

  • ๋กœ๊ทธ ๋ถ„์„์— ํ•„์š”ํ•œ ๋ฌธ์„œ ๋ฐ ์ƒ˜ํ”Œ์„ ์ œ๊ณตํ•˜๋Š”๊ฐ€?
  • ๋ถ„์„์— ํ•„์š”ํ•œ ์ถฉ๋ถ„ํ•œ ์ •๋ณด๋ฅผ ๋‹ด๊ณ  ์žˆ๋Š”๊ฐ€?
  • ๋กœ๊ทธ ๊ตฌ์กฐ ๋ณ€๊ฒฝ์‹œ ๋ฒ„์ „ ๊ด€๋ฆฌ๊ฐ€ ์šฉ์ดํ•œ๊ฐ€?

๊ฒฝ์˜์ž ๋ฐ ๊ด€๋ฆฌ๋ถ€์„œ

  • ์‹ ๊ทœ ์„œ๋น„์Šค๋ฅผ ์œ„ํ•œ ๊ฐ€์ด๋“œ ๋ฌธ์„œ๊ฐ€ ์กด์žฌํ•˜๋Š”๊ฐ€?
  • ์ธ๋ ฅ ์ดํƒˆ์ด๋‚˜ ๊ต์ฒด์— ๋Œ€์‘ํ•˜๋„๋ก ์ผ๊ด€๋œ ํ˜•์‹์„ ๊ฐ–๋Š”๊ฐ€?
  • ์šด์˜ ์ง€ํ‘œ ์ถ”์ถœ์— ์ถฉ๋ถ„ํ•œ ์ •๋ณด๋ฅผ ๋‹ด๊ณ  ์žˆ๋Š”๊ฐ€?
  • ํ•ด์™ธ ์„œ๋น„์Šค๋ฅผ ์œ„ํ•œ ๋‹ค๊ตญ์–ด ๋ฌธ์„œ๋ฅผ ์ง€์›ํ•˜๋Š”๊ฐ€?

๋กœ๊ทธ ํ‘œ์ค€์˜ ์š”๊ฑด ์•ž์—์„œ ๋งํ•œ ๋‹ค์–‘ํ•œ ํ•„์š”์„ฑ์„ ๋งŒ์กฑํ•˜๊ณ , ๊ฑด๊ฐ•ํ•œ ํ‘œ์ค€์œผ๋กœ์„œ์˜ ๋กœ๊ทธ ์ž‘์„ฑ ๋ฐ ํ™œ์šฉ์„ ์œ„ํ•ด์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์š”๊ฑด์„ ์ œ์•ˆํ•œ๋‹ค.

๋กœ๊ทธ ๋ช…์„ธ๋ฅผ URL์„ ํ†ตํ•ด ๋ˆ„๊ตฌ๋‚˜ ์ ‘๊ทผ์ด ๊ฐ€๋Šฅํ•˜๋„๋ก ๊ณต๊ฐœ

  • ๋‹ค์–‘ํ•œ ๊ด€๋ จ์ž์˜ ๊ณต์œ /ํ™œ์šฉ์„ ์œ„ํ•ด ๊ณต๊ฐœ๋Š” ํ•„์ˆ˜์ ์ด๋‹ค.
  • ๋กœ๊ทธ์˜ ๋‚ด์šฉ๊ณผ ๋‹ฌ๋ฆฌ, ๋กœ๊ทธ์˜ ๋ช…์„ธ๋Š” ๋ณด์•ˆ ๋ฐ ๊ฐœ์ธ์ •๋ณด์— ๋ฏผ๊ฐํ•˜์ง€ ์•Š๋‹ค.
  • URL์„ ํ†ตํ•ด ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์œผ๋กœ, ๋‹ค์–‘ํ•œ ๋ช…์„ธ ํŒŒ์ผ์ด ์‚ฐ์žฌํ•˜๋Š” ํ˜ผ๋ž€์„ ํ”ผํ•  ์ˆ˜ ์žˆ๋‹ค.

๋…์  ํฌ๋งท๊ณผ ๋ฐ”์ด๋„ˆ๋ฆฌ ํ˜•์‹์ด ์•„๋‹ ๊ฒƒ

  • ํŠน์ • ์—…์ฒด์˜ ์ƒ์šฉ ์Šคํ”„๋ ˆ๋“œ ์‰ฌํŠธ๋‚˜ ์›Œ๋“œ ํ”„๋กœ์„ธ์Šค๋กœ ๊ธฐ์ˆ ๋œ ๋ช…์„ธ๋Š” ์ ‘๊ทผ์„ฑ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ๋ฐ”์ด๋„ˆ๋ฆฌ ํฌ๋งท์€ ๋ฒ„์ „ ๊ด€๋ฆฌ๊ฐ€ ์–ด๋ ต๋‹ค.

๋กœ๊ทธ ๋ช…์„ธ๋Š” ๋…๋ฆฝ์ ์ธ ํ˜•์‹(Formulation) ์–ธ์–ด๋กœ ๊ธฐ์ˆ ํ•  ๊ฒƒ

  • ์ž์—ฐ์–ด๋กœ ๊ธฐ์ˆ ๋œ ํ‘œ์ค€์€ ๋ชจํ˜ธ์„ฑ์ด ์ƒ์กดํ•˜๊ธฐ์—, ๋…ผ๋ฆฌ์  ์™„๊ฒฐ์„ฑ์„ ๊ฐ€์ง„ ์–ธ์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋ฐ”๋žŒ์งํ•˜๋‹ค.
  • SQL์ด๋‚˜ ํŠน์ • ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด์— ์˜์กดํ•œ ๊ธฐ์ˆ ์€, ๋กœ๊ทธ ํ‘œ์ค€์„ ์œ„ํ•œ ๋‹ค์–‘ํ•œ ํ•„์š”์„ฑ์„ ๋งŒ์กฑ์‹œํ‚ฌ ์ˆ˜ ์—†๋‹ค.

๊ฐœ๋ฐœ์ธก์—๋„ ๋„์›€์ด ๋˜๋Š” ๋ฐฉ๋ฒ•๋ก 

  • ํผ๋ธ”๋ฆฌ์…”์˜ ์ž…์žฅ์„ ๊ฐ•์š”ํ•˜๋Š” ํ‘œ์ค€์ด ์•„๋‹ˆ๋ผ, ๊ฐœ๋ฐœ์ธก์— ์‹ค์งˆ์ ์ธ ๋„์›€์ด ๋˜๋Š” ๋ฐฉ๋ฒ•๋ก ์œผ๋กœ์„œ ์ž๋ฆฌ๋ฉ”๊น€ ํ• ๊ฒƒ.

๋กœ๊ทธ ํ‘œ์ค€ํ™”์˜ ๋ฐฉํ–ฅ ์•ž์˜ ์š”๊ฑด์„ ๋งŒ์กฑํ•˜๋„๋ก ์•„๋ž˜์™€ ๊ฐ™์€ ํ‘œ์ค€ํ™” ๋ฐฉํ–ฅ์„ ์ œ์•ˆํ•œ๋‹ค.

  • ๋กœ๊ทธ ์ •์˜์šฉ ์–ธ์–ด๋ฅผ ๋งŒ๋“ค๊ณ , ์ด๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๋กœ๊ทธ ํ‘œ์ค€์•ˆ์„ ๊ธฐ์ˆ ํ•œ๋‹ค.
  • ์œ„์›ํšŒ๋Š” ํ•จ๊ป˜ ํ‘œ์ค€ ๋กœ๊ทธ ๋ช…์„ธ๋ฅผ ์„ค๊ณ„ํ•˜๊ณ , ๊ด€๋ จ ํˆด์„ ๊ฐœ๋ฐœํ•ด ์ œ๊ณตํ•œ๋‹ค.
  • ๊ฐœ๋ฐœ์ธก์€ ์ด๊ฒƒ์„ ์ค€์ˆ˜/ํ™•์žฅํ•˜์—ฌ ์‹ค์ œ ์„œ๋น„์Šค ๋กœ๊ทธ๋ฅผ ๊ฐœ๋ฐœํ•œ๋‹ค.
  • ๋กœ๊ทธ ํ‘œ์ค€์•ˆ ๋ฐ ์ด๋ฅผ ํ™œ์šฉํ•œ ์„œ๋น„์Šค๋ณ„ ๋กœ๊ทธ ๋ช…์„ธ์˜ ๊ด€๋ฆฌ๋Š” Github์˜ ๊ณต๊ฐœ ์ €์žฅ์†Œ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

๋กœ๊ทธ ์„ค๊ณ„ ํ”„๋ ˆ์ž„์›์˜ ๊ฐœ๋ฐœ ์•ž์˜ ๋ฐฉํ–ฅ์— ๋งž๋„๋ก ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ธฐ๋Šฅ์˜ ๋กœ๊ทธ ์„ค๊ณ„ ํ”„๋ ˆ์ž„์›์„ ๊ฐœ๋ฐœํ•œ๋‹ค.

๊ฐ์ฒด ์ง€ํ–ฅ์  ๋กœ๊ทธ ์„ค๊ณ„

  • ๊ธฐ์กด ๋กœ๊ทธ์˜ ์ •์˜์„œ๋ฅผ ๋ณด๋ฉด ์ด๋ฒคํŠธ๋Š” ๋‹ค์–‘ํ•˜๋‚˜ ๋งŽ์€ ์ค‘๋ณต ์†์„ฑ์ด ์žˆ์Œ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค.
  • ์ค‘๋ณต์—๋Š” ํ•„์š”์—†๋Š” ๋น„์šฉ๊ณผ ์˜ค๋ฅ˜๊ฐ€ ๋”ฐ๋ฅด๊ธฐ ๋งˆ๋ จ์ด๋‹ค.
  • ๊ฐ์ฒด ์ง€ํ–ฅ์  ๋กœ๊ทธ ์„ค๊ณ„๋กœ ์ด๋Ÿฐ ๋‹จ์ ์„ ๋ฐฉ์ง€ํ•˜๊ณ , ๋กœ๊ทธ์˜ ์œ ์ง€ ๋ณด์ˆ˜์„ฑ์„ ์ข‹๊ฒŒ ํ•œ๋‹ค.

๋กœ๊ทธ ๋ฌธ์„œ ์ƒ์„ฑ

  • ๋กœ๊ทธ ์ •์˜ ์–ธ์–ด๋กœ ๊ธฐ์ˆ ํ•œ ๋กœ๊ทธ ๋ช…์„ธ์—์„œ ์ž๋™์œผ๋กœ ๋‹ค์–‘ํ•œ ํฌ๋งท(Text, HTML, Markdown)์˜ ๋กœ๊ทธ ์„ค๋ช… ๋ฌธ์„œ๋ฅผ ์ž๋™ ์ƒ์„ฑํ•œ๋‹ค.
  • ๋กœ๊ทธ ๋ช…์„ธ์— ๋‹ค๊ตญ์–ด ์„ค๋ช…์ด ํฌํ•จ๋˜๋ฉด ํ•ด๋‹น ์–ธ์–ด๋ฅผ ์œ„ํ•œ ๋ฌธ์„œ๋„ ์ƒ์„ฑํ•œ๋‹ค.

์ƒ˜ํ”Œ ๋กœ๊ทธ ์ƒ์„ฑ ๋กœ๊ทธ ๋ช…์„ธ์—๋Š” ์‹ค์ œ ๋กœ๊ทธ์™€ ๊ฐ™์ง€ ์•Š๋”๋ผ๋„, ์œ ์šฉํ•œ ์ƒ˜ํ”Œ ๋กœ๊ทธ ์ƒ์„ฑ์— ์ถฉ๋ถ„ํ•œ ์ •๋ณด๋ฅผ ๋‹ด๊ณ  ์žˆ๋‹ค. ์ƒ˜ํ”Œ๋กœ๊ทธ ์ƒ์„ฑ ๊ธฐ๋Šฅ์œผ๋กœ,

  • ๊ฐœ๋ฐœ์ž๋Š” ๋กœ๊ทธ์˜ ์˜ˆ๋ฅผ ๋ณด๋ฉฐ ๋กœ๊ทธ ์ฝ”๋”ฉ ์ž‘์—…์„ ํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ๋ฐ์ดํ„ฐ ์—”์ง€๋‹ˆ์–ด๋Š” ์„œ๋น„์Šค ์˜คํ”ˆ์ „์— ๋ฏธ๋ฆฌ ์ˆ˜์ง‘/์ฒ˜๋ฆฌ ๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ๋ฐ์ดํ„ฐ ๊ณผํ•™์ž๋Š” ์ƒ˜ํ”Œ ๊ธฐ๋ฐ˜์œผ๋กœ ์ง€ํ‘œ ๋ฐ ๋ถ„์„์˜ ํ‹€์„ ๋ฏธ๋ฆฌ ์ค€๋น„ํ•  ์ˆ˜ ์žˆ๋‹ค.

์ƒ˜ํ”Œ ๋กœ๊ทธ์˜ ์ถœ๋ ฅ์€ ๋‹ค์–‘ํ•œ ํฌ๋งท(JSON, CSV/TSV, SQL)์„ ์ง€์›ํ•œ๋‹ค.

๋กœ๊ทธ ๊ฒ€์ฆ

  • ๊ฐœ๋ฐœ ์ธก์—์„œ ์ƒ์„ฑ๋œ ๋กœ๊ทธ๊ฐ€ ๋กœ๊ทธ ์ •์˜์— ๋งž๋Š”์ง€ ํ…Œ์ŠคํŠธ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•œ๋‹ค.

๋กœ๊ทธ ์Šคํ‚ค๋งˆ ์ƒ์„ฑ

  • ๋‹ค์–‘ํ•œ ๋กœ๊ทธ ์ถœ๋ ฅ ๋ฏธ๋””์–ด ์ง€์›์„ ์œ„ํ•ด, ๋กœ๊ทธ ์ •์˜์—์„œ RDB, Parquet ๋“ฑ ๋กœ๊ทธ ์Šคํ‚ค๋งˆ๋ฅผ ์ž๋™ ์ƒ์„ฑ

ํ‘œ์ค€ ๋กœ๊ทธ์˜ ๋‚ด์šฉ ์ข‹์€ ๊ทธ๋ฆ‡๋„ ๋‚˜์œ ์Œ์‹์ด ๋‹ด๊ฒจ ์žˆ์œผ๋ฉด ์˜๋ฏธ๊ฐ€ ์—†์„ ๊ฒƒ์ด๋‹ค. ์•ž์—์„œ ๋งํ•œ ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•ด ์ž‘์„ฑ๋  ๋กœ๊ทธ ํ‘œ์ค€ ๋ช…์„ธ์—๋Š” ์–ด๋–ค ๋‚ด์šฉ์ด ๋‹ด๊ฒจ์•ผ ํ• ๊นŒ? ๊ตฌ์ฒด์ ์ธ ๋ช…์„ธ๋Š” ์•ž์œผ๋กœ ์ธํ„ฐ๋ทฐ๋ฅผ ํ†ตํ•ด ๋กœ๊ทธ ์ •์˜ ์–ธ์–ด๋กœ ์ž‘์„ฑ๋  ๊ฒƒ์ด๋ฉฐ, ์ด๊ณณ์—๋Š” ์–ด๋–ค ์ข…๋ฅ˜์˜ ์ด๋ฒคํŠธ๋ฅผ ์–ด๋–ป๊ฒŒ ๋‚จ๊ฒจ์•ผ ํ•˜๋Š”์ง€์— ๋Œ€ํ•œ ์›์น™์„ ๊ธฐ๋กํ•  ์˜ˆ์ •์ด๋‹ค.

[[TODO]]

์ž‘์—… ์‚ฐ์ถœ๋ฌผ ์•ž์—์„œ ๋งํ•œ ๋ฐฉํ–ฅ์— ์˜๊ฑฐํ•˜์—ฌ, ์œ„์›ํšŒ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ 3 ๊ฐ€์ง€๋ฅผ ์‚ฐ์ถœ๋ฌผ์„ ์ œ๊ณตํ•œ๋‹ค.

  1. ๋กœ๊ทธ ์ •์˜์šฉ ์–ธ์–ด
  2. ์ด ์–ธ์–ด๋กœ ๊ธฐ์ˆ ๋œ ํ™•์žฅ ๊ฐ€๋Šฅํ•œ ๋กœ๊ทธ ํ‘œ์ค€
  3. ๋กœ๊ทธ ๊ฐœ๋ฐœ ๋ฐ ํ™œ์šฉ์— ๋„์›€์„ ์ฃผ๋Š” ํˆด

๊ฐœ๋ฐœ์ธก์€ ์ด ์‚ฐ์ถœ๋ฌผ์„ ํ™œ์šฉํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ 2 ๊ฐ€์ง€์˜ ์‚ฐ์ถœ๋ฌผ์„ ์ƒ์‚ฐํ•œ๋‹ค.

  1. ๋กœ๊ทธ ํ‘œ์ค€์•ˆ ๊ธฐ๋ฐ˜์œผ๋กœ ์„œ๋น„์Šค์˜ ํ•„์š”์— ๋งž๊ฒŒ ์ˆ˜์ •/ํ™•์žฅ๋œ ๋กœ๊ทธ ๋ช…์„ธ
  2. ์„œ๋น„์Šค ๋กœ๊ทธ ๋ช…์„ธ์— ๋งž๋Š” ๋กœ๊ทธ๋ฅผ ์ƒ์„ฑํ•˜๋Š” ์„œ๋น„์Šค ์ฝ”๋“œ

๋ ˆ๊ฐ€์‹œ์˜ ์ˆ˜์šฉ

ํšŒ์‚ฌ์—๋Š” ์กฐ์ง ๋‚ด/์™ธ๋ถ€์—์„œ ๊ฐœ๋ฐœํ•œ ๋‹ค์–‘ํ•œ ์„œ๋น„์Šค์˜ ๋กœ๊ทธ๊ฐ€ ์ƒ์„ฑ/ํ™œ์šฉ ๋˜๊ณ  ์žˆ๋‹ค. ์ผ๊ด€๋œ ํ˜•ํƒœ๋Š” ์•„๋‹์ง€๋ผ๋„, ์ด ๋กœ๊ทธ๋“ค์€ ๋‹ค์–‘ํ•œ ๊ฒฝํ—˜๊ณผ ์ง€์‹์˜ ์‚ฐ๋ฌผ์ธ ๊ฒƒ์ด๋‹ค. ํ‘œ์ค€ํ™” ์œ„์›ํšŒ๋Š” ๋‹ค์Œ ๋‘ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์œผ๋กœ ๊ธฐ์กด ๋ ˆ๊ฐ€์‹œ๋ฅผ ํฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒ ๋‹ค.

๊ธฐ์กด ๋กœ๊ทธ์˜ ๋…ธํ•˜์šฐ๋ฅผ ์ƒˆ ํ‘œ์ค€์— ๋ฐ˜์˜

  • ๊ธฐ์กด ๋กœ๊ทธ๋ฅผ ๋งŒ๋“ค๊ณ  ํ™œ์šฉํ•œ ๋‹ด๋‹น์ž๋“ค๊ณผ ์ธํ„ฐ๋ทฐ๋ฅผ ํ†ตํ•ด, ์™œ ๊ทธ๋Ÿฐ ๋กœ๊ทธ๊ฐ€ ์™œ ๋งŒ๋“ค์–ด ์กŒ๊ณ , ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ๋Š”์ง€ ํŒŒ์•….
  • ๊ทธ ๋…ธํ•˜์šฐ๋ฅผ ์‚ด๋ ค ์ƒˆ๋กœ์šด ๋กœ๊ทธ ํ‘œ์ค€์— ๋ฐ˜์˜.

์ž„ํฌํ„ฐ๋ฅผ ํ†ตํ•ด ํ‘œ์ค€ ๋กœ๊ทธ ํ˜•ํƒœ๋กœ ๋ณ€ํ™˜

  • ์Šคํ”„๋ ˆ๋“œ์‰ฌํŠธ๋‚˜ ์›Œ๋“œํ”„๋กœ์„ธ์Šค ํŒŒ์ผ๋กœ ๋œ ๊ธฐ์กด ๋กœ๊ทธ์˜ ๋ช…์„ธ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ, ๊ทธ๊ฒƒ์„ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ž‘์„ฑ.
  • ๊ธฐ์กด ๋กœ๊ทธ๋„ ์ƒˆ๋กœ์šด ๋กœ๊ทธ ํ‘œ์ค€์œผ๋กœ ๋ณ€ํ™˜๋  ๊ฒฝ์šฐ, ์œ ์ง€ ๋ณด์ˆ˜์„ฑ์ด ์ข‹์•„์ง€๊ณ  ํ”„๋ ˆ์ž„์›์ด ์ œ๊ณตํ•  ๋‹ค์–‘ํ•œ ํˆด์„ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ.

LogLab (๊ฐ€์•ˆ)

์†Œ๊ฐœ์™€ ์„ค์น˜

๋กœ๊ทธ๋žฉ์€ ๋กœ๊ทธ๋ฅผ ์„ค๊ณ„ํ•˜๊ณ  ํ™œ์šฉํ•˜๊ธฐ ์œ„ํ•œ ํˆด์ด๋‹ค. ํฌ๊ฒŒ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ธฐ๋Šฅ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค:

  • ๋กœ๊ทธ๋ฅผ ๊ฐ์ฒด์ง€ํ–ฅ์ ์œผ๋กœ ์„ค๊ณ„
  • ์„ค๊ณ„๋œ ๋กœ๊ทธ์˜ ๋ฌธ์„œ ์ถœ๋ ฅ
  • ์„ค๊ณ„๋œ ๋กœ๊ทธ์˜ ์ƒ˜ํ”Œ(๊ฐ€์งœ) ๋กœ๊ทธ ์ƒ์„ฑ
  • ๋กœ๊ทธ๊ฐ€ ์„ค๊ณ„์— ๋งž๊ฒŒ ์ž‘์„ฑ๋˜์—ˆ๋Š”์ง€ ๊ฒ€์ฆ

๋กœ๊ทธ๋žฉ์€ https://github.com/haje01/loglab ์—์„œ ๋ฐ›์„ ์ˆ˜ ์žˆ๋‹ค. [[TODO]]

$ git checkout https://github.com/haje01/loglab
$ pip install -e .

์œผ๋กœ ์„ค์น˜ํ•˜์ž.

๋กœ๊ทธ๋žฉ์€ '๋ฉ”ํƒ€ํŒŒ์ผ'๋กœ ๋ถˆ๋ฆฌ๋Š” JSON ํŒŒ์ผ์— ๋กœ๊ทธ ๋ช…์„ธ๋ฅผ ๊ธฐ์ˆ ํ•˜๋Š” ๊ฒƒ์œผ๋กœ ๋กœ๊ทธ๋ฅผ ์„ค๊ณ„ํ•œ๋‹ค. ๋ฉ”ํƒ€ํŒŒ์ผ์€ ๋กœ๊ทธ๋žฉ์—์„œ ์ œ๊ณตํ•˜๋Š” JSON ์Šคํ‚ค๋งˆ ํ˜•์‹์— ๋งž์ถ”์–ด ์ž‘์„ฑํ•˜๋ฉฐ, ํ™•์žฅ์ž๋Š” .meta.json ์„ ์‚ฌ์šฉํ•œ๋‹ค. VSCode ๋“ฑ JSON ์Šคํ‚ค๋งˆ๋ฅผ ์ง€์›ํ•˜๋Š” ์—๋””ํ„ฐ๋ฅผ ์ด์šฉํ•˜๋ฉด ํŽธ์ง‘์ด ์šฉ์ดํ•  ๊ฒƒ์ด๋‹ค.

๊ฐ„๋‹จํ•œ ๋กœ๊ทธ ๋ช…์„ธ ๋งŒ๋“ค๊ธฐ

๋กœ๊ทธ๋žฉ์˜ ์‚ฌ์šฉ๋ฒ•์„ ๋น ๋ฅด๊ฒŒ ์‚ดํŽด๋ณด๊ธฐ์œ„ํ•ด, ์• ํฌ๋ฏธ(Acme)๋ผ๋Š” ๊ฐ€์ƒ์˜ ๊ฒŒ์ž„ ํšŒ์‚ฌ์˜ foo ๋ผ๋Š” ๋ชจ๋ฐ”์ผ ๊ฒŒ์ž„์„ ์œ„ํ•œ ๋ฉ”ํƒ€ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด ๋ณด์ž.

{
	"events": {
		"Login": {
			"desc": "์œ ์ € ๋กœ๊ทธ์ธ.",
		}
	}
}

events ์š”์†Œ ์•„๋ž˜์— ์‚ฌ์šฉํ•  ๋กœ๊ทธ ์ด๋ฒคํŠธ ์š”์†Œ๋ฅผ ์ •์˜ํ•˜๋ฉด ๋œ๋‹ค. ์—ฌ๊ธฐ์„œ๋Š” Login ์ด๋ฒคํŠธ๋ฅผ ์ •์˜ํ•˜๊ณ  ์žˆ๋‹ค. desc ์š”์†Œ์— ์ด๋ฒคํŠธ์˜ ์„ค๋ช…์„ ๊ธฐ์ž…ํ•œ๋‹ค.

์ด ํŒŒ์ผ์„ foo.meta.json ์ด๋ผ๋Š” ํŒŒ์ผ๋ช…์œผ๋กœ ์ €์žฅํ•˜๊ณ , ๋กœ๊ทธ๋žฉ์˜ ๋ฌธ์„œ ์ถœ๋ ฅ ๊ธฐ๋Šฅ์„ ์ด์šฉํ•ด ๋ณด๊ฒ ๋‹ค. ๋ฌธ์„œ ์ถœ๋ ฅ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ช…๋ น์œผ๋กœ ํ•œ๋‹ค.

$ loglab -m foo.meta.json doc

์ด ๋ช…๋ น์€ -m ์ธ์ž๋กœ ์‚ฌ์šฉํ•  ๋ฉ”ํƒ€ํŒŒ์ผ์„ ์ง€์ •ํ•œ ํ›„, doc ๋ถ€๋ช…๋ น์œผ๋กœ ๋ฌธ์„œ๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ถœ๋ ฅ๋œ๋‹ค.

Event : Login
Description: ์œ ์ € ๋กœ๊ทธ์ธ.
+------------+----------+---------------+------------+
| Property   | Type     | Description   | Required   |
|------------+----------+---------------+------------+
| Datetime   | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ   |  true      |
| Event      | string   | ์ด๋ฒคํŠธ ํƒ€์ž…   |  true      |
+------------+----------+---------------+------------+

Login ์— ๋Œ€ํ•œ ๋ฌธ์„œ๊ฐ€ ์ถœ๋ ฅ๋œ๋‹ค. ๊ฐ ์†์„ฑ๋ณ„๋กœ ํ–‰์ด ๋‚˜์˜ค๊ณ , ์†์„ฑ ์ด๋ฆ„(Property), ํƒ€์ž…(Type), ์„ค๋ช…(Description), ํ•„์ˆ˜ ์—ฌ๋ถ€(Required) ์ปฌ๋Ÿผ์œผ๋กœ ์†์„ฑ์„ ์„ค๋ช…ํ•˜๊ณ  ์žˆ๋‹ค. Required๊ฐ€ true์ธ ์†์„ฑ์€ ํ•ด๋‹น ์ด๋ฒคํŠธ์— ๊ผญ ํ•„์š”ํ•œ ํ•„์ˆ˜ ์†์„ฑ์ด๋ฉฐ, false์ธ ๊ฒฝ์šฐ ์—†์–ด๋„ ๋ฌด๊ด€ํ•œ ์„ ํƒ ์†์„ฑ์ด๋‹ค. ๊ธฐ๋ณธ์ ์œผ๋กœ ๋ชจ๋“  ์†์„ฑ์€ ํ•„์ˆ˜ ์†์„ฑ์ด๋‹ค.

์ฒซ ํ–‰์— ๋งŒ๋“ค์–ด ์ฃผ์ง€ ์•Š์€ Datetime ์ด๋ผ๋Š” ์†์„ฑ์ด ๋ณด์ธ๋‹ค. ๋ชจ๋“  ๋กœ๊ทธ ์ด๋ฒคํŠธ๋Š” ์ถœ๋ ฅ ์‹œ๊ฐ„์ด ๊ผญ ํ•„์š”ํ•˜๊ธฐ์—, ๋กœ๊ทธ๋žฉ์—์„œ ์ž๋™์œผ๋กœ ๋งŒ๋“ค์–ด ์ฃผ๋Š” ์†์„ฑ์ด๋‹ค. ๋‹ค์Œ์œผ๋กœ Event๋Š” ์ด๋ฒคํŠธ์˜ ์ข…๋ฅ˜๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค. ๋ฌธ์„œ ์ถœ๋ ฅ์‹œ ์›ํ•˜์ง€ ์•Š๋Š” ์ปฌ๋Ÿผ์€ --exclude-column ์ธ์ž๋กœ ๋ฌด์‹œํ•  ์ˆ˜ ์žˆ๋‹ค. Required๋ฅผ ์ œ์™ธํ•˜๊ณ  ๋‹ค์‹œ ๋ฌธ์„œ๋ฅผ ๋ณด๋ฉด,

$ loglab -m foo.meta.json doc --exclude-column required

Event : Login
Description: ์œ ์ € ๋กœ๊ทธ์ธ.
+------------+----------+---------------+
| Property   | Type     | Description   |
|------------+----------+---------------+
| Datetime   | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ   |
| Event      | string   | ์ด๋ฒคํŠธ ํƒ€์ž…   |
+------------+----------+---------------+

Required ์ปฌ๋Ÿผ์ด ๋น ์ง„ ๋ฌธ์„œ๊ฐ€ ์ถœ๋ ฅ๋œ๋‹ค.

์ด์ œ ์—ฌ๊ธฐ์— ๋กœ๊ทธ์ธํ•œ ์„œ๋ฒ„ID ์†์„ฑ์„ ์ถ”๊ฐ€ํ•ด ๋ณด์ž. ์†์„ฑ์€ ์ด๋ฒคํŠธ ๊ฐ์ฒด ์•„๋ž˜ props ์š”์†Œ๋ฅผ ์ด์šฉํ•œ๋‹ค. ๋กœ๊ทธ๋žฉ์˜ ์ด๋ฒคํŠธ ๋ฐ ์†์„ฑ์˜ ์ด๋ฆ„์€ ๊ฐ ๋‹จ์–ด์˜ ์‹œ์ž‘์„ ๋Œ€๋ฌธ์ž๋กœ(Pascal Case) ํ•œ๋‹ค.

{
	"events": {
		"Login": {
			"desc": "์œ ์ € ๋กœ๊ทธ์ธ.",
			"props": [
				["ServerNo", "integer", "์„œ๋ฒ„ ๋ฒˆํ˜ธ"]
			]
		}
	}
}

props ๋Š” ์–ด๋ ˆ์ด ๊ฐ’์œผ๋กœ, ํ•˜๋‚˜ ์ด์ƒ์˜ ์†์„ฑ์„ ๊ธฐ์ˆ ํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ฐ ์†์„ฑ์€ ์–ด๋ ˆ์ด ํ˜•์‹ ๋˜๋Š” ๊ฐ์ฒด ํ˜•์‹์œผ๋กœ ๊ธฐ์ˆ ํ•  ์ˆ˜ ์žˆ๋‹ค. ์–ด๋ ˆ์ด ํ˜•์‹์€ ๊ฐ„๋‹จํžˆ ์†์„ฑ์„ ์ถ”๊ฐ€ํ•  ๋•Œ ์œ ์šฉํ•˜๋ฉฐ [์†์„ฑ_์ด๋ฆ„, ์†์„ฑ_ํƒ€์ž…, ์†์„ฑ_์„ค๋ช…, ํ•„์ˆ˜์—ฌ๋ถ€(์ƒ๋žต๊ฐ€๋Šฅ)]์˜ ์ˆœ์œผ๋กœ ๊ธฐ์ˆ ํ•œ๋‹ค. ๊ฐ์ฒด ํ˜•์‹์€ ์ดํ›„์— ์‚ดํŽด๋ณด๊ฒ ๋‹ค.

๋‹ค์‹œ ๋ฌธ์„œ๋ฅผ ์ถœ๋ ฅํ•ด ๋ณด์ž.

$ loglab -m foo.meta.json doc

Event : Login
Description: ์œ ์ € ๋กœ๊ทธ์ธ.
+------------+----------+---------------+-----------+
| Property   | Type     | Description   | Required  |
|------------+----------+---------------+-----------+
| Datetime   | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ   |  true     |
| Event      | string   | ์ด๋ฒคํŠธ ํƒ€์ž…   |  true     |
| ServerNo   | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ     |  true     |
+------------+----------+---------------+-----------+

ServerNo๊ฐ€ ์ถ”๊ฐ€๋œ ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค. ์ด์ œ Logout ์ด๋ฒคํŠธ๋ฅผ ์ƒˆ๋กœ ์ถ”๊ฐ€ํ•ด ๋ณด์ž.

	"events": {
		"Login": {
			"desc": "์œ ์ € ๋กœ๊ทธ์ธ.",
			"props": [
				["ServerNo", "integer", "์„œ๋ฒ„ ๋ฒˆํ˜ธ"]
			]
		},
		"Logout": {
			"desc": "์œ ์ € ๋กœ๊ทธ์•„์›ƒ.",
			"props": [
				["ServerNo", "integer", "์„œ๋ฒ„ ๋ฒˆํ˜ธ"]
			]
		}
	}
}

๋‹ค์‹œ ๋ฌธ์„œ๋ฅผ ๋ณด๋ฉด

$ loglab -m foo.meta.json doc --skip required --exclude-column required

Event : Login
Description: ์œ ์ € ๋กœ๊ทธ์ธ.
+------------+----------+---------------+
| Property   | Type     | Description   |
|------------+----------+---------------|
| Datetime   | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ   |
| Event      | string   | ์ด๋ฒคํŠธ ํƒ€์ž…   |
| ServerNo   | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ     |
+------------+----------+---------------+

Event : Logout
Description: ์œ ์ € ๋กœ๊ทธ์•„์›ƒ.
+------------+----------+---------------+
| Property   | Type     | Description   |
|------------+----------+---------------|
| Datetime   | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ   |
| Event      | string   | ์ด๋ฒคํŠธ ํƒ€์ž…   |
| ServerNo   | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ     |
+------------+----------+---------------+

๋กœ๊ทธ์•„์›ƒ ์ด๋ฒคํŠธ๊ฐ€ ์ถ”๊ฐ€๋œ ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

์œ„์—์„œ ๊ฐ™์€ ServerNo ์†์„ฑ์ด ๋กœ๊ทธ์ธ๊ณผ ๋กœ๊ทธ์•„์›ƒ์—์„œ ์ค‘๋ณต๋˜๊ณ  ์žˆ๋Š”๋ฐ, ๊ฐ์ฒด ์ฐธ์กฐ ๊ธฐ๋Šฅ์„ ์ด์šฉํ•˜์—ฌ ๋ฆฌํŒฉํ† ๋งํ•ด ๋ณด์ž.

{
	"bases": {
		"Common": {
			"desc": "๊ณตํ†ต ์š”์†Œ."
			"props": [
				["ServerNo", "integer", "์„œ๋ฒ„ ๋ฒˆํ˜ธ"]
			]
		}
	},
	"events": {
		"Login": {
			"desc": "์œ ์ € ๋กœ๊ทธ์ธ.",
			"mixins": ["bases.Common"]
		},
		"Logout": {
			"desc": "์œ ์ € ๋กœ๊ทธ์•„์›ƒ.",
			"mixins": ["bases.Common"]
		}
	}
}

์ฐธ์กฐ๋  ๊ณตํ†ต ์†์„ฑ์„ bases ์š”์†Œ ์•„๋ž˜ ๋ฒ ์ด์Šค ์š”์†Œ ํ˜•์‹์œผ๋กœ ์ •์˜ํ•˜๋ฉด ๋œ๋‹ค. ๋ฒ ์ด์Šค ์š”์†Œ๋Š” ์ด๋ฒคํŠธ์™€ ๋น„์Šทํ•˜๋‚˜, ์ง์ ‘ ์ถœ๋ ฅ๋˜์ง€ ์•Š๊ณ , ์ด๋ฒคํŠธ ์š”์†Œ๋‚˜ ๋‹ค๋ฅธ Base ์š”์†Œ์—์„œ ์ฐธ์กฐ๋˜๊ธฐ ์œ„ํ•œ ์šฉ๋„์ด๋‹ค.

Login/Logout ์ด๋ฒคํŠธ์—์„œ๋Š” mixins ์š”์†Œ๋ฅผ ํ†ตํ•ด ์ฐธ์กฐํ•  ํ•˜๋‚˜ ์ด์ƒ์˜ ๋ฒ ์ด์Šค๋‚˜ ์ด๋ฒคํŠธ ์š”์†Œ๋ฅผ ๊ธฐ์ˆ ํ•  ์ˆ˜ ์žˆ๋‹ค. bases.Common์˜ bases๋Š” ๋ฃจํŠธ ์š”์†Œ์˜ ์ด๋ฆ„์ด๊ณ , Common์€ ์ฐธ์กฐํ•  ๋ฒ ์ด์Šค ์š”์†Œ์˜ ์ด๋ฆ„์ด๋‹ค.๏ฟฝ ์ด๋ฒคํŠธ ์š”์†Œ๋ฅผ ์ฐธ์กฐํ•˜๋ ค๋ฉด events.์ด๋ฒคํŠธ_์ด๋ฆ„ ์‹์ด ๋œ๋‹ค.

๋งŒ์•ฝ mixins์— ํ•˜๋‚˜ ์ด์ƒ์˜ ์š”์†Œ๊ฐ€ ์žˆ๊ณ  ๊ทธ๋“ค๊ฐ„ ๊ฒน์น˜๋Š” ์†์„ฑ์ด ์žˆ์œผ๋ฉด, ๋‚˜์ค‘์— ๋“ฑ์žฅํ•˜๋Š” ๊ฒƒ์˜ ์†์„ฑ์ด ์šฐ์„ ํ•˜๊ฒŒ ๋œ๋‹ค.

์ฐธ์กฐ๋˜๋Š” ์ธก๊ณผ ์ฐธ์กฐํ•˜๋Š” ์ธก์— ๊ฐ™์€ ์š”์†Œ๊ฐ€ ๊ฒน์น˜๋ฉด, ์ฐธ์กฐํ•˜๋Š” ์ธก์˜ ๊ฒƒ์„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋œ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ์œ„์˜ bases.Common ๊ณผ events.Login ๋ชจ๋‘์— desc ์š”์†Œ๊ฐ€ ์žˆ๋Š”๋ฐ, ์ด ๊ฒฝ์šฐ Login ์˜ desc ์š”์†Œ๊ฐ€ ์šฐ์„ ํ•˜๊ฒŒ ๋œ๋‹ค.

์ˆ˜์ •๋œ ๋ฉ”ํƒ€ํŒŒ์ผ๋กœ ๋‹ค์‹œ ๋ฌธ์„œ๋ฅผ ์ถœ๋ ฅํ•˜๋ฉด, ๋ฆฌํŒฉํ† ๋ง ์ „๊ณผ ๊ฐ™์€ ๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ์ด๋‹ค.

์ƒ˜ํ”Œ ๋กœ๊ทธ์™€ ์†์„ฑ๊ฐ’ ์ œ์•ฝํ•˜๊ธฐ

์‹ค์ œ ๋กœ๊ทธ๊ฐ€ ์–ด๋–ป๊ฒŒ ์ƒ๊ฒผ๋Š”์ง€ ๋ฏธ๋ฆฌ ์‚ดํŽด๋ณผ ์ˆ˜ ์žˆ๋‹ค๋ฉด, ๋กœ๊ทธ๋ฅผ ๋งŒ๋“ค๊ฑฐ๋‚˜ ์ฒ˜๋ฆฌํ•˜๋Š” ์ž…์žฅ์—์„œ ๋„์›€์ด ๋  ๊ฒƒ์ด๋‹ค. ๋กœ๊ทธ๋žฉ์—์„œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ƒ˜ํ”Œ ๋กœ๊ทธ๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค.


{
	"Logout": {
		"Datetime": "2019-11-13T20:20:39+09:00",
		"ServerNo": -1932
	}
}
{
	"Login": {
		"Datetime": "2019-11-13T20:20:40+09:00",
		"ServerNo": 94840191
	}
}
{
	"Login": {
		"Datetime": "2019-11-13T20:20:41+09:00",
		"ServerNo": -3948
	}
}
{
	"Logout": {
		"Datetime": "2019-11-13T20:20:42+09:00",
		"ServerNo": 114938
	}
}

์ž„์˜์˜ ์ด๋ฒคํŠธ ๋กœ๊ทธ๊ฐ€ 4๊ฐœ ์ƒ์„ฑ์ด ๋˜์—ˆ๋‹ค. Datetime ์†์„ฑ์€ ํ˜„์žฌ ์‹œ๊ฐ„์—์„œ ์ฆ๊ฐ€ํ•˜๋Š” ์‹์œผ๋กœ ์ฑ„์›Œ์ง„๋‹ค. ๋กœ๊ทธ๋žฉ์˜ ๋‚ ์ž ๋ฐ ์‹œ๊ฐ„ ํ˜•์‹์€ RFC3339๋ฅผ ๋”ฐ๋ฅธ๋‹ค. (https://json-schema.org/latest/json-schema-validation.html#RFC3339)

ServerNo ์†์„ฑ์˜ ๊ฐ’์€ ์ข€ ํŠน์ดํ•œ๋ฐ, ์ง€๋‚˜์น˜๊ฒŒ ํฐ ๊ฐ’์ด๋‚˜ ์Œ์˜ ์ˆ˜๊ฐ€ ์„ž์—ฌ์„œ ๋‚˜์˜ค๊ณ  ์žˆ๋‹ค. ์ด๋Š” ์†์„ฑ์˜ ํƒ€์ž…์ธ integerํ˜•์— ๋งž์ถฐ ์ž„์˜์˜ ๊ฐ’์ด ์ฑ„์›Œ์ง€๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ์ข€ ๋” ๊ทธ๋Ÿด๋“ฏํ•œ ์„œ๋ฒ„ ๋ฒˆํ˜ธ๋ฅผ ์œ„ํ•ด ์†์„ฑ ๊ฐ’์— ์ œ์•ฝ์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋‹จ, ์ œ์•ฝ์„ ์ง€์ •ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” props ์•„๋ž˜ ์†์„ฑ๊ฐ’์„ ๋ฆฌ์ŠคํŠธํ˜•์ด ์•„๋‹Œ ๊ฐ์ฒดํ˜•์œผ๋กœ ๊ธฐ์ˆ ํ•ด์•ผ ํ•œ๋‹ค.

{
	"bases": {
		"Common": {
			"desc": "๊ณตํ†ต ์š”์†Œ."
			"props": [
				{
					"name": "ServerNo",
					"desc": "์„œ๋ฒ„ ๋ฒˆํ˜ธ",
					"type": "integer",
					"minimum": 1,
					"maximum": 10
				}
			]
		}
	},
	"events": {
		"Login": {
			"desc": "์œ ์ € ๋กœ๊ทธ์ธ.",
			"mixins": ["bases.Common"]
		},
		"Logout": {
			"desc": "์œ ์ € ๋กœ๊ทธ์•„์›ƒ.",
			"mixins": ["bases.Common"]
		}
	}
}

์†์„ฑ์„ ๊ฐ์ฒดํ˜•์œผ๋กœ ๊ธฐ์ˆ ํ•  ๋•Œ๋Š” name, type, desc ๋“ฑ์ด ํ•„์ˆ˜ ์š”์†Œ์ด๋ฉฐ, ํ•„์š”์— ๋”ฐ๋ผ ์ œ์•ฝ ๋“ฑ ๋‹ค์–‘ํ•œ ์ถ”๊ฐ€ ์š”์†Œ๋ฅผ ๊ธฐ์ˆ ํ•  ์ˆ˜ ์žˆ๋‹ค.

๋‹ค์‹œ ์ƒ˜ํ”Œ ๋กœ๊ทธ๋ฅผ ๋ณด๋ฉด

$ loglab -m foo.meta.json sample

{
	"Logout": {
		"Datetime": "2019-11-13T20:20:39+09:00",
		"ServerNo": 3
	}
}
{
	"Login": {
		"Datetime": "2019-11-13T20:20:40+09:00",
		"ServerNo": 9
	}
}
{
	"Login": {
		"Datetime": "2019-11-13T20:20:41+09:00",
		"ServerNo": 1
	}
}
{
	"Logout": {
		"Datetime": "2019-11-13T20:20:42+09:00",
		"ServerNo": 4
	}
}

์—ฌ์ „ํžˆ ์ž„์˜์˜ ์†์„ฑ๊ฐ’์ด๋‚˜, ์ œ์•ฝ์— ๋งž์ถฐ ์ข€ ๋” ๊ทธ๋Ÿด๋“ฏํ•ด ๋ณด์ธ๋‹ค. ๋ฌธ์„œ์—์„œ๋„ ์†์„ฑ์˜ ์ œ์•ฝ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

$ loglab -m foo.meta.json doc --exclude-column required

Event : Login
Description: ์œ ์ € ๋กœ๊ทธ์ธ.
+------------+----------+-----------------+------------------+
| Property   | Type     | Description     | Constraint       |
|------------+----------+-----------------+------------------+
| Datetime   | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ     |                  |
| Event      | string   | ์ด๋ฒคํŠธ ํƒ€์ž…     |                  |
| ServerNo   | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ       | 1์ด์ƒ 10์ดํ•˜     |
+------------+----------+-----------------+------------------+

Event : Logout
Description: ์œ ์ € ๋กœ๊ทธ์•„์›ƒ.
+-------------+----------+----------------+----------------+
| Property    | Type     | Description    | Constraint     |
|-------------+----------+----------------+----------------+
| Datetime    | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ    |                |
| Event       | string   | ์ด๋ฒคํŠธ ํƒ€์ž…    |                |
| ServerNo    | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ      | 1์ด์ƒ 10์ดํ•˜   |
+-------------+----------+----------------+----------------+

์ด๋Ÿฌํ•œ ์†์„ฑ๊ฐ’ ์ œ์•ฝ์€ ๋‚˜์ค‘์— ์„ค๋ช…ํ•  ๋กœ๊ทธ ๊ฒ€์ฆ์‹œ์—๋„ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ๋‹ค. ์œ„์™€ ๊ฐ™์ด ๋กœ๊ทธ๋žฉ ์š”์†Œ์˜ ์†์„ฑ์— ์ œ์•ฝ์„ ๊ฐ€ํ•  ๋•Œ๋Š” JSON ์Šคํ‚ค๋งˆ์˜ ๋ฐฉ์‹์„ ๋”ฐ๋ฅธ๋‹ค. ๋‹ค์–‘ํ•œ ์ œ์•ฝ ๋ฐฉ๋ฒ•์ด ์žˆ์œผ๋‹ˆ https://json-schema.org/understanding-json-schema/reference/index.html ์„ ์ฐธ๊ณ ํ•˜์ž.

์ด์ œ, ๊ณตํ†ต ์š”์†Œ์™€ ๋ณ„๋„๋กœ ์ด๋ฒคํŠธ๋ณ„ ์†์„ฑ์„ ์‚ฌ์šฉํ•ด ๋ณด์ž. ์˜ˆ๋กœ Login์—๋Š” Platform ์†์„ฑ์„, Logout์—๋Š” PlayTime ์†์„ฑ์„ ์ถ”๊ฐ€ํ•˜๊ฒ ๋‹ค.

{
	"bases": {
		"Common": {
			"desc": "๊ณตํ†ต ์š”์†Œ."
			"props": [
				{
					"name": "ServerNo",
					"desc": "์„œ๋ฒ„ ๋ฒˆํ˜ธ",
					"type": "integer",
					"minimum": 1,
					"maximum": 10
				}
			]
		}
	},
	"events": {
		"Login": {
			"desc": "์œ ์ € ๋กœ๊ทธ์ธ.",
			"mixins": ["bases.Common"],
			"props": [
				{
					"name": "Platform",
					"desc": "๋””๋ฐ”์ด์Šค ํ”Œ๋žซํผ",
					"type": "string":,
					"enum": ["ios", "aos"]
				}
			]
		},
		"Logout": {
			"desc": "์œ ์ € ๋กœ๊ทธ์•„์›ƒ.",
			"mixins": ["bases.Common"],
			"props": [
				{
					"name": "PlayTime",
					"desc": "ํ”Œ๋ ˆ์ด ์‹œ๊ฐ„(๋ถ„)."
					"type": "integer",
					"minimum": 0
				}
			]
		}
	}
}

Login์— ์ถ”๊ฐ€๋œ Platform ์†์„ฑ์€ ์œ ์ €๊ฐ€ ๋กœ๊ทธ์ธ์‹œ ์ด์šฉํ•œ ๋ชจ๋ฐ”์ผ ๋””๋ฐ”์ด์Šค์˜ ํ”Œ๋žซํผ์„ ๊ฐ€์ •ํ–ˆ๋‹ค. string ํƒ€์ž…์ด๋˜ enum์œผ๋กœ ๋‚˜์—ดํ˜• ์ œ์•ฝ์ด ์žˆ๋‹ค. enum์€ ๋ฆฌ์ŠคํŠธ ๊ฐ’์„ ๊ฐ€์ง€๋ฉฐ ์—ฌ๊ธฐ์— ๋“ฑ๋ก๋œ ๊ฐ’๋งŒ ํ—ˆ์šฉ๋œ๋‹ค. Logout์— ์ถ”๊ฐ€๋œ PlayTime์€ ์œ ์ €๊ฐ€ ๋กœ๊ทธ์ธ ํ›„ ๋กœ๊ทธ์•„์›ƒ๊นŒ์ง€ ํ”Œ๋ ˆ์ดํ•œ ์‹œ๊ฐ„์„ ์˜๋ฏธํ•˜๋ฉฐ ๋ถ„์„ ๋‹จ์œ„๋กœ ํ•œ๋‹ค. 0์ด์ƒ ๊ฐ’๋งŒ ํ—ˆ์šฉํ•˜๋Š” ์ œ์•ฝ์ด ์žˆ๋‹ค.

์ด์ œ ๋‹ค์‹œ ๋กœ๊ทธ ๋ฌธ์„œ๋ฅผ ์‚ดํŽด๋ณด์ž.

$ loglab -m foo.meta.json doc --exclude-column required

Event : Login
Description: ์œ ์ € ๋กœ๊ทธ์ธ.
+------------+----------+-----------------+------------------+
| Property   | Type     | Description     | Constraint       |
|------------+----------+-----------------+------------------+
| Datetime   | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ     |                  |
| Event      | string   | ์ด๋ฒคํŠธ ํƒ€์ž…     |                  |
| ServerNo   | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ       | 1์ด์ƒ 10์ดํ•˜     |
| Platform   | string   | ๋””๋ฐ”์ด์Šค ํ”Œ๋žซํผ | ios, aos ์ค‘ ์„ ํƒ |
+------------+----------+-----------------+------------------+

Event : Logout
Description: ์œ ์ € ๋กœ๊ทธ์•„์›ƒ.
+-------------+----------+----------------+----------------+
| Property    | Type     | Description    | Constraint     |
|-------------+----------+----------------+----------------+
| Datetime    | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ    |                |
| Event       | string   | ์ด๋ฒคํŠธ ํƒ€์ž…    |                |
| ServerNo    | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ      | 1์ด์ƒ 10์ดํ•˜   |
| PlayTime    | integer  | ์„ธ์…˜ ์‹œ๊ฐ„(๋ถ„)  | 0 ์ด์ƒ         |
+-------------+----------+----------------+----------------+

์ด๋ฒคํŠธ๋ณ„๋กœ ์ƒˆ๋กœ์šด ์†์„ฑ์ด ์ถ”๊ฐ€๋˜์—ˆ๋‹ค. Login ์ด๋ฒคํŠธ์—๋Š” Platform ์†์„ฑ์ด, Logout ์ด๋ฒคํŠธ์—๋Š” PlayTime ์†์„ฑ์— ๋Œ€ํ•œ ์„ค๋ช…์ด ๋‚˜์˜ค๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

๋กœ๊ทธ์˜ ๊ฒ€์ฆ

๊ฐœ๋ฐœ์ž๋Š” ์ž˜ ์ •์˜๋œ ๋ช…์„ธ์™€ ๊ฑฐ๊ธฐ์—์„œ ์ƒ์„ฑ๋œ ๋ฌธ์„œ ๋ฐ ์ƒ˜ํ”Œ์„ ์ฐธ๊ณ ํ•ด ๋กœ๊ทธ ์ฝ”๋“œ๋ฅผ ๋งŒ๋“ค์—ˆ๋‹ค ํ•˜๋”๋ผ๋„, ์—ฌ์ „ํžˆ ์ƒ์„ฑ๋œ ๋กœ๊ทธ๊ฐ€ ํ‘œ์ค€์— ์ ํ•ฉํ•œ์ง€ ํ™•์ธํ•˜๊ณ  ์‹ถ์„ ์ˆ˜ ์žˆ๋‹ค. ๋กœ๊ทธ๋žฉ์˜ ๋กœ๊ทธ ๊ฒ€์ฆ ๊ธฐ๋Šฅ์„ ์ด์šฉํ•˜๋ฉด ์ƒ์„ฑ๋œ ๋กœ๊ทธ์˜ ํ‘œ์ค€ ์ค€์ˆ˜ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•˜๊ณ , ๋งŒ์•ฝ ๋ฌธ์ œ๊ฐ€ ๋˜๋Š” ๋ถ€๋ถ„์ด ์žˆ๋‹ค๋ฉด ์–ด๋””์—์„œ ์–ด๋–ค ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š”์ง€ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋‚ด์šฉ์˜ JSON ๋กœ๊ทธํŒŒ์ผ my_log.json์ด ์žˆ๋‹ค๊ณ  ํ•˜์ž.

{
	"Login": {
		"Datetime": "2019-11-13T20:20:41+09:00",
        "ServerNo": 1,
        "Platform": ios
	}
}
{
	"Logout": {
		"Datetime": "2019-11-13T20:21:42+09:00",
		"ServerNo": "1"
	}
}

์•„๋ž˜์˜ ๋ช…๋ น์œผ๋กœ ์ด๊ฒƒ์„ ๊ฒ€์ฆํ•  ์ˆ˜ ์žˆ๋‹ค.

$ loglab -m foo.meta.json verify my_log.json

Error: Not a valid JSON file.
  json.decoder.JSONDecodeError: Expecting value: line 5 column 21 (char 100)

๋จผ์ € ๋ฐœ์ƒํ•œ ๋ฌธ์ œ๋Š” ์ด ๋กœ๊ทธ ํŒŒ์ผ์ด ์œ ํšจํ•œ JSON ํŒŒ์ผ์ด ์•„๋‹ˆ๋ผ๋Š” ๊ฒƒ์ด๋‹ค. ์œ„์˜ Platform ์†์„ฑ์˜ ๊ฐ’์ธ ios ์— ๋ฌธ์ž์—ด์„ ์œ„ํ•œ ์ฟผํ…Œ์ด์…˜ ๋งˆํฌ๊ฐ€ ์—†๊ธฐ ๋•Œ๋ฌธ. ์ด๋ฅผ "ios"๋กœ ์ˆ˜์ •ํ•˜์—ฌ ๋‹ค์‹œ ๋Œ๋ ค๋ณด์ž.

$ loglab -m foo.meta.json verify my_log.json

Error: Value type mismatch.
  'ServerNo' is not of type 'integer'

์•ž์—์„œ integer ํ˜•์œผ๋กœ ๋ช…์‹œํ•œ ServerNo์˜ ๊ฐ’์— ์ •์ˆ˜๊ฐ€ ์•„๋‹Œ ๋ฌธ์ž์—ด "1"์ด ์˜จ ๊ฒƒ์ด ๋ฌธ์ œ์ด๋‹ค. ์ด๊ฒƒ๋„ 1๋กœ ์ˆ˜์ •ํ•˜์—ฌ ๋‹ค์‹œ ๋Œ๋ ค๋ณด์ž.

$ loglab -m foo.meta.json verify my_log.json

Error: Required property 'PlayTime' does not exist!

Logout ์ด๋ฒคํŠธ์— (๊ธฐ๋ณธ์ ์œผ๋กœ)ํ•„์ˆ˜๋กœ ์„ ์–ธ๋œ PlayTime ์†์„ฑ์ด ์กด์žฌํ•˜์ง€ ์•Š์•„ ๋ฐœ์ƒํ•œ ๋ฌธ์ œ์ด๋‹ค. PlayTime์„ ์ถ”๊ฐ€ํ•ด ๋‹ค์‹œ ๊ฒ€์ฆํ•˜๋ฉด ์ด์ œ ๋ชจ๋“  ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋  ๊ฒƒ์ด๋‹ค.

$ loglab -m foo.meta.json verify my_log.json

`my_log.json` is a valid log file!

๊ณต์šฉ ๋ฉ”ํƒ€ํŒŒ์ผ์˜ ์ด์šฉ

์ง€๊ธˆ๊นŒ์ง€๋Š” ๋‹จ์ˆœํžˆ ํ•˜๋‚˜์˜ ์„œ๋น„์Šค๋ฅผ ์œ„ํ•œ ๋กœ๊ทธ ๋ฉ”ํƒ€ํŒŒ์ผ์„ ์ž‘์„ฑํ•ด ๋ณด์•˜๋‹ค. ๋งŒ์•ฝ ์กฐ์ง์—์„œ ์šด์šฉํ•˜๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ ์„œ๋น„์Šค๊ฐ€ ์กด์žฌํ•˜๊ณ , ๊ทธ ๋กœ๊ทธ๋“ค์ด ํ‘œ์ค€์ ์ธ ํ˜•์‹์„ ์œ ์ง€ํ•˜๋„๋ก ํ•˜๋ ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผ ํ• ๊นŒ?

๋กœ๊ทธ๋žฉ์—์„œ๋Š” ๋ฉ”ํƒ€ํŒŒ์ผ๋“ค๊ฐ„ ๊ณตํ†ต์ ์„ ๋ฆฌํŒฉํ† ๋งํ•ด ๊ณต์šฉ ๋ฉ”ํƒ€ํŒŒ์ผ์„ ๋งŒ๋“ค๊ณ , ๋‹ค๋ฅธ ๋ฉ”ํƒ€ํŒŒ์ผ์ด ๊ทธ๊ฒƒ์„ ์ฐธ์กฐํ•˜์—ฌ ์ผ๊ด€์„ฑ์„ ์ง€ํ‚ค๋„๋ก ํ•  ์ˆ˜ ์žˆ๋‹ค.

์•ž์—์„œ ์‚ดํŽด๋ณธ ๊ฐ€์ƒ์˜ ์• ํฌ๋ฏธ ๊ฒŒ์ž„ ํšŒ์‚ฌ์˜ ๋ชจ๋ฐ”์ผ ๊ฒŒ์ž„ foo ์™ธ์—, ์ƒˆ๋กœ์šด ์˜จ๋ผ์ธ ๊ฒŒ์ž„ boo ๋ฅผ ๋งŒ๋“ค๊ณ  ์žˆ๋‹ค๊ณ  ํ•˜์ž.๏ฟฝ ์ด ํšŒ์‚ฌ๋Š” ๋‘ ์„œ๋น„์Šค๊ฐ€ ๊ณตํ†ต ํ‘œ์ค€์„ ๋”ฐ๋ฅด๊ธฐ๋ฅผ ์›ํ•˜๊ณ , ์ด์— ์• ํฌ๋ฏธ๋ฅผ ์œ„ํ•œ ๊ณต์šฉ ๋ฉ”ํƒ€ํŒŒ์ผ์„ ์ž‘์„ฑํ•˜๊ธฐ๋กœ ํ•œ๋‹ค.

foo์˜ ๋‚ด์šฉ์„ ๋Œ€๋ถ€๋ถ„ ์ฐจ์šฉํ•ด ์•„๋ž˜์ฒ˜๋Ÿผ acme.meta.json ์„ ์ž‘์„ฑํ•œ๋‹ค.

{
    "info": {
		"name": "์• ํฌ๋ฏธ ๋กœ๊ทธ ํ‘œ์ค€",
		"desc": "์• ํฌ๋ฏธ์˜ ๋กœ๊ทธ ํ‘œ์ค€ ๋ช…์„ธ. ์ž์„ธํ•œ ๊ฒƒ์€ https://github.com/acme/loglab ์„ ์ฐธ๊ณ ํ•˜์„ธ์š”."""
    },
	"bases": {
		"Common": {
			"props": [
				{
					"name": "ServerNo",
					"type": "integer",
					"minimum": 1,
					"maximum": 10
				}
			]
		}
	},
	"events": {
		"Login": {
			"desc": "๋กœ๊ทธ์ธ",
			"mixins": ["bases.Common"],
			"props": [
				{
					"name": "Platform",
					"desc": "๋””๋ฐ”์ด์Šค ํ”Œ๋žซํผ",
					"type": "string",
				}
			]
		},
		"Logout": {
			"desc": "๋กœ๊ทธ์•„์›ƒ",
			"mixins": ["bases.Common"],
			"props": [
				{
					"name": "PlayTime",
					"desc": "ํ”Œ๋ ˆ์ด ์‹œ๊ฐ„(๋ถ„)."
					"type": "integer",
					"minimum": 0
				}
			]
		}
	}
}

ํŠน์ง• ์ ์ธ ๊ฒƒ์€ ๊ฐ€์žฅ ๋จผ์ € ๋‚˜์˜ค๋Š” info ์š”์†Œ์ด๋‹ค. ์—ฌ๊ธฐ์— ๋ฉ”ํƒ€ํŒŒ์ผ์— ๊ด€ํ•œ ์—ฌ๋Ÿฌ ์ •๋ณด ์š”์†Œ๋ฅผ ๊ธฐ์ˆ ํ•  ์ˆ˜ ์žˆ๋‹ค. name์€ ๋ฉ”ํƒ€ํŒŒ์ผ์˜ ์ด๋ฆ„์ด๊ณ , desc ๋Š” ๋ฉ”ํƒ€ํŒŒ์ผ์— ๊ด€ํ•œ ์ถ”๊ฐ€์ ์ธ ์„ค๋ช…์ด๋‹ค. ๋‹ค์–‘ํ•œ ๋ฉ”ํƒ€ํŒŒ์ผ์„ ์‚ฌ์šฉํ•  ๋•Œ ๋„์›€์ด ๋  ๊ฒƒ์ด๋‹ค.

๋‚˜๋จธ์ง€๋Š” ๊ธฐ์กด์— foo ๋ฉ”ํƒ€ํŒŒ์ผ์˜ ๋‚ด์šฉ ์ค‘, ๋ชจ๋ฐ”์ผ ํŠนํ™”๋œ ๋‚ด์šฉ์ธ Platform์˜ enum ์„ ์ œ์™ธํ•œ ๋Œ€๋ถ€๋ถ„ ์š”์†Œ๋ฅผ ๊ฐ€์ ธ์™”๋‹ค. ๋ฌธ์„œ๋ฅผ ์ถœ๋ ฅํ•ด๋ณด๋ฉด, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋‚˜์˜จ๋‹ค.

$ loglab -m acme.meta.json doc --exclude-column required

Meta : ์• ํฌ๋ฏธ ๋กœ๊ทธ ํ‘œ์ค€
Meta Description: ์• ํฌ๋ฏธ์˜ ๋กœ๊ทธ ํ‘œ์ค€ ๋ช…์„ธ. ์ž์„ธํ•œ ๊ฒƒ์€ https://github.com/acme/loglab ์„ ์ฐธ๊ณ ํ•˜์„ธ์š”.

Event : Login
Description: ์œ ์ € ๋กœ๊ทธ์ธ.
+------------+----------+-----------------+------------------+
| Property   | Type     | Description     | Constraint       |
|------------+----------+-----------------+------------------+
| Datetime   | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ     |                  |
| Event      | string   | ์ด๋ฒคํŠธ ํƒ€์ž…     |                  |
| ServerNo   | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ       | 1์ด์ƒ 10์ดํ•˜     |
| Platform   | string   | ๋””๋ฐ”์ด์Šค ํ”Œ๋žซํผ |                  |
+------------+----------+-----------------+------------------+

Event : Logout
Description: ์œ ์ € ๋กœ๊ทธ์•„์›ƒ.
+-------------+----------+----------------+----------------+
| Property    | Type     | Description    | Constraint     |
|-------------+----------+----------------+----------------+
| Datetime    | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ    |                |
| Event       | string   | ์ด๋ฒคํŠธ ํƒ€์ž…    |                |
| ServerNo    | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ      | 1์ด์ƒ 10์ดํ•˜   |
| PlayTime    | integer  | ์„ธ์…˜ ์‹œ๊ฐ„(๋ถ„)  | 0 ์ด์ƒ         |
+-------------+----------+----------------+----------------+

์ด์ œ ๊ธฐ์กด์˜ foo ๋ฉ”ํƒ€ํŒŒ์ผ์ด ์ด๊ฒƒ์„ ์ฐธ์กฐํ•˜๋„๋ก foo.meta.json์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ˆ˜์ •ํ•œ๋‹ค.

{
	"info": {
		"name": "foo ๋กœ๊ทธ ๋ช…์„ธ",
		"desc": "๋ชจ๋ฐ”์ผ ๊ฒŒ์ž„ foo์˜ ๋กœ๊ทธ ๋ช…์„ธ. ์ž์„ธํ•œ ๊ฒƒ์€ https://github.com/acme/loglab/foo ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”
	},
	"metas": [
		["https://github.com/acme/loglab/aceme.meta.json", "acme"]
	],
	"events": {
		"Login": {
			"mixins": ["acme.events.Login"],
			"props": [
				{
					"name": "Platform",
					"enum": ["ios", "aos"]
				}
			]
		}
	}
}

์ƒˆ๋กœ์šด metas ์š”์†Œ๊ฐ€ ๋ณด์ธ๋‹ค. ์—ฌ๊ธฐ์— ์ฐธ์กฐํ•˜๋Š” ๊ณต์šฉ ๋ฉ”ํƒ€ํŒŒ์ผ์„ [๋ฉ”ํƒ€ํŒŒ์ผ_URL, ๋ฉ”ํƒ€ํŒŒ์ผ_๋ณ„์นญ] ํ˜•์‹์œผ๋กœ ํ•˜๋‚˜ ์ด์ƒ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๋‹ค.

์ด๋Ÿฐ ์‹์œผ๋กœ ๋‹ค๋ฅธ ์™ธ๋ถ€ ๋ฉ”ํƒ€ํŒŒ์ผ์„ ์ฐธ์กฐํ•˜๋ฉด, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํšจ๊ณผ๊ฐ€ ์žˆ๋‹ค.

  • mixins์—์„œ ๋ณ„์นญ์„ ํ†ตํ•ด ์™ธ๋ถ€ ๋ฉ”ํƒ€ํŒŒ์ผ์˜ ๋ฒ ์ด์Šค๋‚˜ ์ด๋ฒคํŠธ ์š”์†Œ๋ฅผ ์ฐธ์กฐ ํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ์ƒ˜ํ”Œ ๋กœ๊ทธ๋‚˜ ๋กœ๊ทธ ์Šคํ‚ค๋งˆ ์ƒ์„ฑ์‹œ, ์ฐธ์กฐ๋œ ๋ฉ”ํƒ€ํŒŒ์ผ์— ์žˆ๋Š” ์ด๋ฒคํŠธ ์š”์†Œ๋„ ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋œ๋‹ค.
  • ์ฐธ์กฐ๋˜๋Š” ์ธก๊ณผ ์ฐธ์กฐํ•˜๋Š” ์ธก์— ๊ฐ™์€ ์š”์†Œ๊ฐ€ ๊ฒน์น˜๋ฉด, ์ฐธ์กฐํ•˜๋Š” ์ธก์˜ ๊ฒƒ์ด ์šฐ์„ ํ•œ๋‹ค.

์œ„ ํŒŒ์ผ์—์„œ๋Š” Login ์ด๋ฒคํŠธ์˜ Platform ์†์„ฑ์˜ enum ๋งŒ ์ง€์ •ํ•˜๊ณ  ์žˆ์ง€๋งŒ, ๋ฌธ์„œ๋ฅผ ์ถœ๋ ฅํ•ด๋ณด๋ฉด,

$ loglab -m foo.meta.json doc --exclude-column required

Meta : foo ๋กœ๊ทธ ๋ช…์„ธ
Meta Description: ๋ชจ๋ฐ”์ผ ๊ฒŒ์ž„ foo์˜ ๋กœ๊ทธ ๋ช…์„ธ. ์ž์„ธํ•œ ๊ฒƒ์€ https://github.com/acme/loglab/foo ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

Event : Login
Description: ์œ ์ € ๋กœ๊ทธ์ธ.
+------------+----------+-----------------+------------------+
| Property   | Type     | Description     | Constraint       |
|------------+----------+-----------------+------------------+
| Datetime   | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ     |                  |
| Event      | string   | ์ด๋ฒคํŠธ ํƒ€์ž…     |                  |
| ServerNo   | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ       | 1์ด์ƒ 10์ดํ•˜     |
| Platform   | string   | ๋””๋ฐ”์ด์Šค ํ”Œ๋žซํผ | ios, aos ์ค‘ ์„ ํƒ |
+------------+----------+-----------------+------------------+

Event : Logout
Description: ์œ ์ € ๋กœ๊ทธ์•„์›ƒ.
+-------------+----------+----------------+----------------+
| Property    | Type     | Description    | Constraint     |
|-------------+----------+----------------+----------------+
| Datetime    | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ    |                |
| Event       | string   | ์ด๋ฒคํŠธ ํƒ€์ž…    |                |
| ServerNo    | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ      | 1์ด์ƒ 10์ดํ•˜   |
| PlayTime    | integer  | ์„ธ์…˜ ์‹œ๊ฐ„(๋ถ„)  | 0 ์ด์ƒ         |
+-------------+----------+----------------+----------------+

๋ฉ”ํƒ€ํŒŒ์ผ ์ฐธ์กฐ๋ฅผ ์ด์šฉํ•˜๊ธฐ ์ „๊ณผ๊ฐ™์ด Login๊ณผ Logout ๋‘ ์ด๋ฒคํŠธ์˜ ๋ชจ๋“  ์†์„ฑ์ด ์ž˜ ์ถœ๋ ฅ๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

๋งˆ์ฐฌ๊ฐ€์ง€๋กœ boo์˜ ๋ฉ”ํƒ€ํŒŒ์ผ boo.meta.json ๋„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ž‘์„ฑํ•˜๊ณ ,

{
	"info": {
		"name": "boo ๋กœ๊ทธ ๋ช…์„ธ",
		"desc": "์˜จ๋ผ์ธ ๊ฒŒ์ž„ boo์˜ ๋กœ๊ทธ ๋ช…์„ธ. ์ž์„ธํ•œ ๊ฒƒ์€ https://github.com/acme/loglab/boo ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”
	},
	"metas": [
		["https://github.com/acme/loglab/aceme.meta.json", "acme"]
	],
	"events": {
		"Login": {
			"mixins": ["acme.events.Login"],
			"props": [
				{
					"name": "Platform",
					"enum": ["pc", "mac", "linux"]
				}
			]
		}
	}
}

๋ฌธ์„œ๋ฅผ ์ถœ๋ ฅํ•ด๋ณด์ž.

$ loglab -m foo.meta.json doc --exclude-column required

Meta : boo ๋กœ๊ทธ ๋ช…์„ธ
Meta Description: ์˜จ๋ผ์ธ ๊ฒŒ์ž„ boo์˜ ๋กœ๊ทธ ๋ช…์„ธ. ์ž์„ธํ•œ ๊ฒƒ์€ https://github.com/acme/loglab/boo ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

Event : Login
Description: ์œ ์ € ๋กœ๊ทธ์ธ.
+------------+----------+-----------------+------------------------+
| Property   | Type     | Description     | Constraint             |
|------------+----------+-----------------+------------------------+
| Datetime   | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ     |                        |
| Event      | string   | ์ด๋ฒคํŠธ ํƒ€์ž…     |                        |
| ServerNo   | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ       | 1์ด์ƒ 10์ดํ•˜           |
| Platform   | string   | ๋””๋ฐ”์ด์Šค ํ”Œ๋žซํผ | pc, mac, linux ์ค‘ ์„ ํƒ |
+------------+----------+-----------------+------------------------+

Event : Logout
Description: ์œ ์ € ๋กœ๊ทธ์•„์›ƒ.
+-------------+----------+----------------+----------------+
| Property    | Type     | Description    | Constraint     |
|-------------+----------+----------------+----------------+
| Datetime    | datetime | ์ด๋ฒคํŠธ ์ผ์‹œ    |                |
| Event       | string   | ์ด๋ฒคํŠธ ํƒ€์ž…    |                |
| ServerNo    | integer  | ์„œ๋ฒ„ ๋ฒˆํ˜ธ      | 1์ด์ƒ 10์ดํ•˜   |
| PlayTime    | integer  | ์„ธ์…˜ ์‹œ๊ฐ„(๋ถ„)  | 0 ์ด์ƒ         |
+-------------+----------+----------------+----------------+

์ด๋Ÿฐ ๋ฐฉ์‹์œผ๋กœ ๊ธฐ๋ณธ ๋กœ๊ทธ ๊ตฌ์กฐ๋Š” ๊ณต์œ ํ•˜๋ฉด์„œ, ์„œ๋น„์Šค๋ณ„๋กœ ํŠนํ™”๋œ ๋‚ด์šฉ๋งŒ ์ถ”๊ฐ€/๊ฐฑ์‹ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

[[TODO]]