Skip to content

Instantly share code, notes, and snippets.

@Al-un
Last active October 29, 2018 14:54
Show Gist options
  • Save Al-un/581ee90fcd54db88301d1bb9dbcc1334 to your computer and use it in GitHub Desktop.
Save Al-un/581ee90fcd54db88301d1bb9dbcc1334 to your computer and use it in GitHub Desktop.
Testing tagged logs
# controllers/catalogs_controller.rb
def show
@catalog = Catalog.includes(article_publications: [:article]).find(params[:id])
logger.debug "Debugging: showing catalogs #{@catalog.id}"
logger.info "Info: showing catalogs #{@catalog.id}"
logger.warn "Warn: showing catalogs #{@catalog.id}"
# add some tagged logs here
logger.tagged("Catalogs show") { logger.debug "Moar stuff" }
logger.tagged("Catalogs show") { logger.info "Stuff" }
logger.tagged("Catalogs show") { logger.tagged("Nested tag") { logger.info "Stuff" } }
# ....
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment